|
| 1 | +name: Rust Semver Checks |
| 2 | +on: |
| 3 | + pull_request_target: |
| 4 | + branches: |
| 5 | + - main |
| 6 | + |
| 7 | +jobs: |
| 8 | + # Check if changes were made to the relevant files. |
| 9 | + # Always returns true if running on the default branch, to ensure all changes are throughly checked. |
| 10 | + changes: |
| 11 | + name: Check for changes |
| 12 | + runs-on: ubuntu-latest |
| 13 | + # Required permissions |
| 14 | + permissions: |
| 15 | + pull-requests: read |
| 16 | + # Set job outputs to values from filter step |
| 17 | + # These outputs are always true when running after a merge to main, or if the PR has a `run-ci-checks` label. |
| 18 | + outputs: |
| 19 | + rust: ${{ steps.filter.outputs.rust == 'true' || steps.override.outputs.out == 'true' }} |
| 20 | + python: ${{ steps.filter.outputs.python == 'true' || steps.override.outputs.out == 'true' }} |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v4 |
| 23 | + - name: Override label |
| 24 | + id: override |
| 25 | + run: | |
| 26 | + echo "Label contains run-ci-checks: $OVERRIDE_LABEL" |
| 27 | + if [ "$OVERRIDE_LABEL" == "true" ]; then |
| 28 | + echo "Overriding due to label 'run-ci-checks'" |
| 29 | + echo "out=true" >> $GITHUB_OUTPUT |
| 30 | + elif [ "$DEFAULT_BRANCH" == "true" ]; then |
| 31 | + echo "Overriding due to running on the default branch" |
| 32 | + echo "out=true" >> $GITHUB_OUTPUT |
| 33 | + fi |
| 34 | + env: |
| 35 | + OVERRIDE_LABEL: ${{ github.event_name == 'pull_request' && contains( github.event.pull_request.labels.*.name, 'run-ci-checks') }} |
| 36 | + DEFAULT_BRANCH: ${{ github.ref_name == github.event.repository.default_branch }} |
| 37 | + - uses: dorny/paths-filter@v3 |
| 38 | + id: filter |
| 39 | + with: |
| 40 | + filters: .github/change-filters.yml |
| 41 | + |
| 42 | + rs-semver-checks: |
| 43 | + needs: [changes] |
| 44 | + if: ${{ needs.changes.outputs.rust == 'true' }} |
| 45 | + uses: CQCL/hugrverse-actions/.github/workflows/rs-semver-checks.yml@main |
| 46 | + with: |
| 47 | + apt-dependencies: capnproto |
| 48 | + secrets: |
| 49 | + GITHUB_PAT: ${{ secrets.HUGRBOT_PAT }} |
0 commit comments