Skip to content

Commit

Permalink
Try v 7
Browse files Browse the repository at this point in the history
  • Loading branch information
markdoeswork committed Sep 24, 2024
1 parent 573639e commit 2f9fa99
Showing 1 changed file with 9 additions and 33 deletions.
42 changes: 9 additions & 33 deletions .github/workflows/github-actions-comment-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,15 @@ on:
types: [opened, synchronize]

jobs:
add-comment:
comment:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Test
uses: actions/[email protected]
id: get_issue_number
- uses: actions/github-script@v7
with:
script: |
if (context.issue.number) {
// Return issue number if present
return context.issue.number;
} else {
// Otherwise return issue number from commit
return (
await github.rest.repos.listPullRequestsAssociatedWithCommit({
commit_sha: context.sha,
owner: context.repo.owner,
repo: context.repo.repo,
})
).data[0].number;
}
result-encoding: string
- name: Issue number
run: echo '${{steps.get_issue_number.outputs.result}}'
- name: Leave PR comment
env:
PR_NUMBER: ${{ steps.get_issue_number.outputs.result }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
curl -H "Authorization: token ${GITHUB_TOKEN}" \
-X POST \
-d '{"body": "🎉 Congratulations "}' \
"https://api.github.com/repos/${{ github.repository }}/issues/${PR_NUMBER}/comments"
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Context test'
})

0 comments on commit 2f9fa99

Please sign in to comment.