Comment Breakage #31
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
| name: Comment Breakage | |
| on: | |
| workflow_run: | |
| workflows: ["Breakage"] | |
| types: | |
| - completed | |
| jobs: | |
| comment_pr: | |
| runs-on: ubuntu-latest | |
| if: > | |
| github.event.workflow_run.event == 'pull_request' && | |
| github.event.workflow_run.conclusion == 'success' | |
| steps: | |
| - name: Download PR number artifact | |
| uses: dawidd6/action-download-artifact@v17 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| workflow: Breakage | |
| run_id: ${{ github.event.workflow_run.id }} | |
| name: pr-number | |
| path: pr-number | |
| use_unzip: true | |
| - name: Read PR number | |
| id: read_pr | |
| run: | | |
| PR_NUMBER=$(cat pr-number/pr-number.txt) | |
| echo "PR_NUMBER=$PR_NUMBER" >> "$GITHUB_ENV" | |
| echo "pr_number=$PR_NUMBER" >> "$GITHUB_OUTPUT" | |
| - name: Download breakage artifacts | |
| uses: dawidd6/action-download-artifact@v17 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| workflow: Breakage | |
| run_id: ${{ github.event.workflow_run.id }} | |
| name: breakage-* | |
| name_is_regexp: true | |
| path: breakage | |
| merge_multiple: true | |
| use_unzip: true | |
| - run: ls -R | |
| - name: Generate summary | |
| run: | | |
| cd breakage | |
| echo "| Package name | latest | stable |" > summary.md | |
| echo "|--|--|--|" >> summary.md | |
| count=0 | |
| for file in breakage-* | |
| do | |
| if [ $count == "0" ]; then | |
| name=$(echo $file | cut -f2 -d-) | |
| echo -n "| $name | " | |
| else | |
| echo -n "| " | |
| fi | |
| cat $file | |
| if [ $count == "0" ]; then | |
| echo -n " " | |
| count=1 | |
| else | |
| echo " |" | |
| count=0 | |
| fi | |
| done >> summary.md | |
| - name: PR comment with file | |
| uses: thollander/actions-comment-pull-request@v2 | |
| with: | |
| filePath: breakage/summary.md | |
| pr_number: ${{ steps.read_pr.outputs.pr_number }} |