Add version check when needs review label is added #1
Workflow file for this run
This file contains 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: Check PR for Review | ||
on: | ||
pull_request: | ||
types: [labeled] | ||
permissions: | ||
contents: read # to fetch code (actions/checkout) | ||
pull-requests: write # to comment on the PR | ||
jobs: | ||
check-pr: | ||
if: contains(github.event.label.name, 'needs review') && github.event.pull_request.draft == "true" | ||
Check failure on line 13 in .github/workflows/version-check.yml GitHub Actions / Check PR for ReviewInvalid workflow file
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Set up Ruby | ||
uses: ruby/setup-ruby@v1 | ||
- name: Verify linked version matches core version | ||
id: pr-details | ||
run: ./script/version_check.sh ${{ github.event.pull_request.body }} | ||
- name: Add comment if versions differ | ||
if: steps.version-check.outputs.version_mismatch == 'true' | ||
uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
github.rest.issues.createComment({ | ||
issue_number: ${{ github.event.pull_request.number }}, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: `Version mismatch detected:\n | ||
- Work package URL: ${steps.pr-details.outputs.wp_url}\n | ||
- Work package version: ${steps.pr-details.outputs.wp_version}\n | ||
- Core version: ${steps.pr-details.outputs.core_version}\n` | ||
}) | ||
- name: Output success | ||
if: success() && steps.version-check.outputs.version_mismatch != 'true' | ||
run: echo "Version check passed." |