Skip to content

Commit

Permalink
run all ci checks when the PR has a label set
Browse files Browse the repository at this point in the history
  • Loading branch information
aborgna-q committed Jun 3, 2024
1 parent d3e22f4 commit 028997e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
23 changes: 20 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,30 @@ jobs:
# Check if changes were made to the relevant files.
# Always returns true if running on the default branch, to ensure all changes are throughly checked.
changes:
name: Check for changes in Rust files
name: Check for changes
runs-on: ubuntu-latest
# Required permissions
permissions:
pull-requests: read
# Set job outputs to values from filter step
# These outputs are always true when running after a merge to main, or if the PR has a `run-ci-checks` label.
outputs:
rust: ${{ github.ref_name == github.event.repository.default_branch || steps.filter.outputs.rust }}
python: ${{ github.ref_name == github.event.repository.default_branch || steps.filter.outputs.python }}
rust: ${{ steps.filter.outputs.rust == 'true' || steps.override.outputs.out == 'true' }}
python: ${{ steps.filter.outputs.python == 'true' || steps.override.outputs.out == 'true' }}
steps:
- uses: actions/checkout@v4
- name: Override label
id: override
run: |
echo "Labels: ${{ github.event.pull_request.labels.*.name }}"
echo "Label contains run-ci-checks: ${{ contains( github.event.pull_request.labels.*.name, 'run-ci-checks') }}"
if [ "${{ github.event_name == 'pull_request' && contains( github.event.pull_request.labels.*.name, 'run-ci-checks') }}" == "true" ]; then
echo "Overriding due to label 'run-ci-checks'"
echo "out=true" >> $GITHUB_OUTPUT
elif [ "${{ github.ref_name == github.event.repository.default_branch }}" == "true" ]; then
echo "Overriding due to running on the default branch"
echo "out=true" >> $GITHUB_OUTPUT
fi
- uses: dorny/paths-filter@v3
id: filter
with:
Expand Down Expand Up @@ -264,6 +277,10 @@ jobs:
if: ${{ !cancelled() }}
runs-on: ubuntu-latest
steps:
- name: Debug changes step output
run: |
echo "Rust: ${{ needs.changes.outputs.rust }}"
echo "Python: ${{ needs.changes.outputs.python }}"
- name: Fail if required checks failed
# This condition should simply be `if: failure() || cancelled()`,
# but there seems to be a bug in the github workflow runner.
Expand Down
3 changes: 3 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ We welcome contributions to tket2! Please open [an issue](https://github.com/CQC

PRs should be made against the `main` branch, and should pass all CI checks before being merged. This includes using the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) format for the PR title.

Some tests may be skipped based on the changes made. To run all the tests in
your PR mark it with a 'run-ci-checks' label and push new commits to it.

The general format of a contribution title should be:

```
Expand Down

0 comments on commit 028997e

Please sign in to comment.