mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-09-08 07:36:55 +08:00
Fix on failure action (#3959)
* Fix on failure action * Bad commit * Use API token * Another bad commit * Fix bad commits
This commit is contained in:
parent
c90ccf05be
commit
dcb505e507
3 changed files with 50 additions and 11 deletions
38
.github/workflows/ci-failure-comment.yml
vendored
Normal file
38
.github/workflows/ci-failure-comment.yml
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
name: Comment on PR for CI Failure
|
||||
permissions:
|
||||
pull-requests: write
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: [Monkey CI]
|
||||
types: [completed]
|
||||
|
||||
jobs:
|
||||
on-failure:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
|
||||
steps:
|
||||
- name: Download workflow artifact
|
||||
uses: dawidd6/action-download-artifact@v2.11.0
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
workflow: peek_icons.yml
|
||||
run_id: ${{ github.event.workflow_run.id }}
|
||||
|
||||
- name: Read the pr_num file
|
||||
id: pr_num_reader
|
||||
uses: juliangruber/read-file-action@v1.0.0
|
||||
with:
|
||||
path: ./pr_num/pr_num.txt
|
||||
|
||||
- name: Create comment
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
github-token: ${{ secrets.API_TOKEN }}
|
||||
script: |
|
||||
github.rest.issues.createComment({
|
||||
issue_number: ${{ steps.pr_num_reader.outputs.content }},
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: 'Continuous integration check(s) failed. Please review the failing check\'s logs and make the necessary changes. ' + context.payload.workflow_run.html_url
|
||||
})
|
2
.github/workflows/labeler.yml
vendored
2
.github/workflows/labeler.yml
vendored
|
@ -11,4 +11,4 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/labeler@v4
|
||||
with:
|
||||
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
repo-token: "${{ secrets.API_TOKEN }}"
|
||||
|
|
21
.github/workflows/monkey-ci.yml
vendored
21
.github/workflows/monkey-ci.yml
vendored
|
@ -159,14 +159,15 @@ jobs:
|
|||
needs: [ci-be, ci-fe, ci-assets]
|
||||
if: ${{ always() && contains(needs.*.result, 'failure') && github.ref != 'refs/heads/master' }}
|
||||
steps:
|
||||
- name: Comment on PR
|
||||
uses: actions/github-script@v6
|
||||
- uses: actions/checkout@v3
|
||||
- name: Save the PR number in an artifact
|
||||
shell: bash
|
||||
env:
|
||||
PR_NUM: ${{ github.event.number }}
|
||||
run: echo $PR_NUM > pr_num.txt
|
||||
|
||||
- name: Upload the PR number
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
github-token: ${{ secrets.API_TOKEN }}
|
||||
script: |
|
||||
github.rest.issues.createComment({
|
||||
issue_number: ${{ github.event.number }},
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: 'Continuous integration check(s) failed. Please review the failing check\'s logs and make the necessary changes. ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'
|
||||
})
|
||||
name: pr_num
|
||||
path: ./pr_num.txt
|
||||
|
|
Loading…
Add table
Reference in a new issue