Post CI #1195
This file contains hidden or 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
| on: | |
| workflow_run: | |
| workflows: | |
| - Continuous Integration | |
| types: | |
| - completed | |
| name: Post CI | |
| # This is adapted from https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_run (2022-07-17) | |
| jobs: | |
| on-failure: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download PR Data Artifact | |
| uses: dawidd6/action-download-artifact@v8 | |
| with: | |
| name: pr_number | |
| workflow: ci.yml | |
| run_id: ${{ github.event.workflow_run.id }} | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| if_no_artifact_found: fail # Fail the job if the artifact is not found | |
| - name: Extract PR Data | |
| id: save-pr-data | |
| run: | | |
| echo "pr_number=$(cat pr_number)" >> $GITHUB_ENV | |
| echo "pr_sha=$(cat pr_sha)" >> $GITHUB_ENV | |
| echo "merge_sha=$(cat merge_sha)" >> $GITHUB_ENV | |
| - name: Add Comment | |
| uses: marocchino/sticky-pull-request-comment@39c5b5dc7717447d0cba270cd115037d32d28443 | |
| if: ${{ github.event.workflow_run.conclusion == 'failure' }} | |
| with: | |
| recreate: true | |
| message: | | |
| The commit ${{ env.pr_sha }} (as a parent of ${{ env.merge_sha }}) contains errors. | |
| Please inspect the [Run Summary](https://github.com/${{ github.repository }}/pull/${{ env.pr_number }}/files) for details. | |
| - name: Add Waiting Label | |
| uses: actions-ecosystem/action-add-labels@bd52874380e3909a1ac983768df6976535ece7f8 | |
| if: ${{ github.event.workflow_run.conclusion == 'failure' }} | |
| with: | |
| labels: w-ci | |
| number: ${{ env.pr_number }} | |
| repo: ${{ github.repository }} | |
| - name: Remove Waiting Label | |
| uses: actions-ecosystem/action-remove-labels@2ce5d41b4b6aa8503e285553f75ed56e0a40bae0 | |
| if: ${{ github.event.workflow_run.conclusion != 'failure' }} | |
| with: | |
| labels: w-ci | |
| number: ${{ env.pr_number }} | |
| repo: ${{ github.repository }} |