Skip to content

Commit

Permalink
ci(gh): add comment when /build_test is finished (#745) (#748)
Browse files Browse the repository at this point in the history
(cherry picked from commit 6b2e997)

Co-authored-by: Ming Yu Wang <90855268+mwangggg@users.noreply.github.com>
  • Loading branch information
mergify[bot] and mwangggg committed Feb 28, 2024
1 parent 830046d commit f204ab3
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/test-ci-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,40 @@ jobs:
ref: ${{ needs.checkout-branch.outputs.PR_head_ref }}
tag: ${{ needs.get-test-image-tag.outputs.tag }}
sha: ${{ needs.checkout-branch.outputs.PR_head_sha }}

successful-test:
runs-on: ubuntu-latest
needs: [run-test-jobs]
permissions:
pull-requests: write
steps:
- name: Leave Actions Run Comment
uses: actions/github-script@v6
with:
script: |
const runURL = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${{ github.run_id }}`;
const commentBody = `\`/build_test\` completed successfully ✅. \n[View Actions Run](${runURL}).`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: commentBody
});
cancelled-test:
if: (always() && contains(needs.*.result, 'failure'))
runs-on: ubuntu-latest
needs: [run-test-jobs]
steps:
- name: Leave Actions Run Comment
uses: actions/github-script@v6
with:
script: |
const runURL = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${{ github.run_id }}`;
const commentBody = `\`/build_test\` : At least one test failed ❌. \n[View Actions Run](${runURL}).`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: commentBody
});

0 comments on commit f204ab3

Please sign in to comment.