feat: add pr-comment-on-release functionality.
#9
Workflow file for this run
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: Test Included Regex | |
| on: | |
| pull_request: {} | |
| jobs: | |
| setup: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Setup | |
| run: echo "Do setup" | |
| test: | |
| runs-on: ubuntu-latest | |
| continue-on-error: true | |
| needs: [setup] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - id: sha-short | |
| run: echo "result=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
| - run: gh release create v0.0.0-test.include.${{ steps.sha-short.outputs.result }} --prerelease --target ${{ github.sha }} --notes "Prerelease used for tests (will be automatically deleted)." | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| outputs: | |
| release: v0.0.0-test.include.${{ steps.sha-short.outputs.result }} | |
| assert: | |
| runs-on: ubuntu-latest | |
| needs: [test] | |
| timeout-minutes: 5 # Timeout for test release workflow to run | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - run: | | |
| # Wait until a release workflow whose tag is tied to this PR's SHA is running | |
| while [[ $(gh run list -w "Test Included Regex" --json databaseId -q 'length' -s completed -c ${{ github.sha }}) -eq 0 ]]; do | |
| sleep 5 | |
| done | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Find Comment (should pass) | |
| uses: peter-evans/find-comment@v3 | |
| id: fc | |
| with: | |
| issue-number: ${{ github.event.pull_request.number }} | |
| body-regex: "^These changes were released in .*${{ needs.test.outputs.release }}.*$" | |
| teardown: | |
| runs-on: ubuntu-latest | |
| needs: [test, assert] | |
| if: ${{ always() }} | |
| steps: | |
| - run: gh release delete ${{ needs.test.outputs.release }} | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |