-
-
Notifications
You must be signed in to change notification settings - Fork 363
Closed
Labels
Description
Description
See #5951 for full context.
We need to migrate all workflows using the on.[event].paths
filtering to use a files-changed
job using dorny/paths-filter
instead. To enforce required checks we need to add a required check job at the end, which always runs and is used as the main indicator for required checks.
An example implementation is done for tests.yml
and api-stability.yml
, reference PR is #5893
Use the following prompt to create a draft PR:
Do the following for these variables:
[WORKFLOW_NAME] = "Release"
[WORKFLOW_KEY] = "release"
[WORKFLOW_FILE] = "release.yml"
Use the file-filters at .github/file-filters.yml and the auto-update-tools workflow .github/workflows/auto-update-tools.yml as reference on how we added a check to enforce required checks. Then create the same for the [WORKFLOW_NAME] workflow:
Requirements:
1. **Add file filter**: Create a new filter called `run_[WORKFLOW_KEY]_for_prs` in .github/file-filters.yml containing all file paths from the workflow's current `on.pull_request.paths` (if it exists, otherwise include relevant paths for that workflow)
2. **Remove the paths filter**: Remove the paths filtering from the `on.pull_request.paths` so the workflow runs always for all pull requests.
3. **Modify workflow**: Update .github/workflows/[WORKFLOW_FILE].yml to:
- Add `files-changed` job that detects file changes using the new filter
- Make the main job(s) conditional with `if: github.event_name != 'pull_request' || needs.files-changed.outputs.run_[WORKFLOW_KEY]_for_prs == 'true'` and `needs: files-changed`
- Add `[WORKFLOW_KEY]-required-check` job at the end that validates completion using `if: always()` pattern
- **IMPORTANT**: Do NOT change the workflow triggers (`on:`) or concurrency settings beyond removing the paths filter
4. **Follow the exact pattern**: Use the auto-update-tools implementation as the template for job structure, naming, and logic.
The goal is to make the workflow:
- Always run for schedule and workflow_dispatch events
- Run conditionally for pull requests based on file changes
- Provide a reliable required check that can be used in branch protection rules
5. In the commit message use the keyword `[skip ci]` to skip the CI. In the PR message use `#skip-changelog` to skip the changelog check. In the pull request body use "Fixes #<this issue id>` to reference the issue to close. Use the title of this issue as the title of the PR.