Created
December 7, 2023 18:55
-
-
Save lxfontes/1a22870b42337d25fc97ec17119a6926 to your computer and use it in GitHub Desktop.
github action on pull request comment
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
name: "QA commands" | |
on: | |
issue_comment: | |
types: [created] | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
if: github.event.issue.pull_request && startsWith(github.event.comment.body, '/qa') | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Do QA things | |
run: | | |
echo "something" | |
- name: Add comment back to PR | |
uses: actions/github-script@v6 | |
if: always() | |
with: | |
script: | | |
const name = '${{ github.workflow }}'; | |
const url = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'; | |
const success = '${{ job.status }}' === 'success'; | |
const body = `${name}: ${success ? 'succeeded ✅' : 'failed ❌'}\n${url}`; | |
await github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: body | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment