generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from BoyWithSilverWings/feature/markdown-comment
Add fn for create comment
- Loading branch information
Showing
7 changed files
with
49 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { USER_REPO, GITHUB_HEAD_REF } from "./constants"; | ||
|
||
function commentMarkdown(path: string) { | ||
const [owner, repo] = USER_REPO; | ||
|
||
return `Your open graph image is ready: | ||
![](https://github.com/${owner}/${repo}/raw/${GITHUB_HEAD_REF}/${path}.jpg) | ||
`; | ||
} | ||
|
||
export default commentMarkdown; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import getPrNumber from "./get-pr-number"; | ||
import { USER_REPO } from "./constants"; | ||
import octokit from "./github-api"; | ||
|
||
const createComment = async body => { | ||
const [owner, repo] = USER_REPO; | ||
const prNumber = getPrNumber(); | ||
|
||
return octokit.issues.createComment({ | ||
owner, | ||
repo, | ||
issue_number: prNumber, | ||
body | ||
}); | ||
}; | ||
|
||
export default createComment; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { GITHUB_CONTEXT } from "./constants"; | ||
|
||
function getPrNumber(): number { | ||
const githubCtx: any = JSON.parse(GITHUB_CONTEXT as string); | ||
const pullNumber = githubCtx.event.number; | ||
return pullNumber; | ||
} | ||
|
||
export default getPrNumber; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters