Skip to content

feat: add pr-comment-on-release functionality. #8

feat: add pr-comment-on-release functionality.

feat: add pr-comment-on-release functionality. #8

Workflow file for this run

name: Test Excluded 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
# Below is the only difference between test-include.yml (the positive counterpart of this workflow).
# test-release.yml will not pick up this comment because include_regex will only match a 'v0.0.0-test.include' prefix.
- run: gh release create v0.0.0-test.exclude.${{ 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.exclude.${{ 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 Excluded 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 fail)
uses: peter-evans/find-comment@v3
id: fc
continue-on-error: true
with:
issue-number: ${{ github.event.pull_request.number }}
body-regex: "^These changes were released in .*${{ needs.test.outputs.release }}.*$"
- name: Assert Comment Not Found
if: steps.fc.outcome != 'success'
run: exit 0
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 }}