Skip to content

Commit

Permalink
chore(ci): skip regression checks for PRs with the `ci-condition: ski…
Browse files Browse the repository at this point in the history
…p-regression` label (#21507)

* chore(ci): regression detector scheduled runs, skip dependabot PRs by default

address review comments

add new label to all ecosystems

fix alignment

* revert unrelated change

* escape the contains expression

* introduce a new job that handles the skipping logic

update a dep I missed

update a dep I missed

* testing
  • Loading branch information
pront authored Oct 16, 2024
1 parent c22f6bd commit 55fd455
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ updates:
labels:
- "domain: deps"
- "no-changelog"
- "ci-condition: skip-regression"
commit-message:
prefix: "chore(deps)"
open-pull-requests-limit: 100
Expand Down Expand Up @@ -71,6 +72,7 @@ updates:
labels:
- "domain: releasing"
- "no-changelog"
- "ci-condition: skip-regression"
commit-message:
prefix: "chore(deps)"
open-pull-requests-limit: 100
Expand All @@ -81,6 +83,7 @@ updates:
labels:
- "domain: ci"
- "no-changelog"
- "ci-condition: skip-regression"
commit-message:
prefix: "chore(ci)"
groups:
Expand Down
39 changes: 31 additions & 8 deletions .github/workflows/regression.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ on:
# Don't want to run this on each PR commit, but because GH doesn't allow specifying different required checks
# for pull request and merge queue, we need to "run" it in pull request, but in the jobs we will just auto pass.
pull_request:

# Also, this workflow runs every Monday at 5:00 AM UTC.
schedule:
- cron: "0 5 * * 1"
concurrency:
# In flight runs will be canceled only by re-trigger through the merge queue or if additional PR commits are pushed.
# The comment.html_url should always be unique.
Expand All @@ -45,11 +47,31 @@ env:

jobs:

# Determine if the suite should run
check-should-run:
runs-on: ubuntu-latest
outputs:
should-run: ${{ steps.set-should-run.outputs.SHOULD_RUN }}
steps:
- name: Determine if should run
id: set-should-run
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "SHOULD_RUN=false" >> $GITHUB_OUTPUT
elif [[ "${{ github.event_name }}" != "pull_request_review" &&
"${{ !contains(github.event.pull_request.labels.*.name, 'ci-condition: skip-regression') }}" == "true" ]]; then
# The small caveat here is that we still want to run the suite via a review comment.
echo "SHOULD_RUN=false" >> $GITHUB_OUTPUT
else
echo "SHOULD_RUN=true" >> $GITHUB_OUTPUT
fi
# Only run this workflow if files changed in areas that could possibly introduce a regression
should-run:
check-source-changed:
runs-on: ubuntu-latest
timeout-minutes: 5
if: github.event_name != 'pull_request'
needs: check-should-run
if: ${{ needs.check-should-run.outputs.should-run == 'true' }}
outputs:
source_changed: ${{ steps.filter.outputs.SOURCE_CHANGED }}
steps:
Expand Down Expand Up @@ -113,8 +135,8 @@ jobs:
name: Compute metadata
runs-on: ubuntu-22.04
timeout-minutes: 5
needs: should-run
if: github.event_name != 'merge_group' || needs.should-run.outputs.source_changed == 'true'
needs: check-source-changed
if: github.event_name != 'merge_group' || needs.check-source-changed.outputs.source_changed == 'true'
outputs:
pr-number: ${{ steps.pr-metadata-merge-queue.outputs.PR_NUMBER || steps.pr-metadata-comment.outputs.PR_NUMBER }}
baseline-sha: ${{ steps.pr-metadata-merge-queue.outputs.BASELINE_SHA || steps.pr-metadata-comment.outputs.BASELINE_SHA }}
Expand Down Expand Up @@ -774,9 +796,10 @@ jobs:
- name: (PR) Indicate why skipped
if: github.event_name == 'pull_request'
run: |
echo "### Workflow skipped" >> $GITHUB_STEP_SUMMARY
echo "This workflow doesn't run on PR's automatically." >> $GITHUB_STEP_SUMMARY
echo "To trigger a run, leave a comment with \`/ci-run-regression\`" >> $GITHUB_STEP_SUMMARY
echo "### Workflow skipped" >> $GITHUB_STEP_SUMMARY
echo "This workflow doesn't run on PRs automatically." >> $GITHUB_STEP_SUMMARY
echo "This workflow doesn't run on PRs with the 'ci-condition: skip-regression' label." >> $GITHUB_STEP_SUMMARY
echo "To trigger a run, leave a review comment with \`/ci-run-regression\`" >> $GITHUB_STEP_SUMMARY
- name: exit
run: |
Expand Down

0 comments on commit 55fd455

Please sign in to comment.