Skip to content

.github/workflows: Avoid running CI on markdown-only pull requests #2500

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

timflannagan
Copy link
Member

Description of the change:
Update the relevant set of workflows defined in the .github/workflows
directory and avoid running the CI-related jobs when PRs only contain
markdown-only changes.

Previously, this functionality was achieved through the paths_ignore
workflow syntax, but that keyword doesn't play well with repositories
that have setup explicit required action context's through branch
protection. This results in documentation-only PRs with the requisite
labels present being gated as those skipped jobs are reported as unknown
checks and automatic merging tooling cannot perform the merge.

See [1] for more information on this behavior.

[1] https://i.8713187.xyzmunity/t/path-filtering-on-required-pull-request-checks/18402/3

Motivation for the change:
Markdown-only PRs labeled with lgtm/approved cannot be successfully merged by tide due to the combination of how the paths-ignore keyword interacts with branch protection rules.

Reviewer Checklist

  • Implementation matches the proposed design, or proposal is updated to match implementation
  • Sufficient unit test coverage
  • Sufficient end-to-end test coverage
  • Docs updated or added to /doc
  • Commit messages sensible and descriptive

@openshift-ci
Copy link

openshift-ci bot commented Nov 29, 2021

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: timflannagan
To complete the pull request process, please assign awgreene after the PR has been reviewed.
You can assign the PR to them by writing /assign @awgreene in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/[email protected]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's alternative actions we can use but I wasn't a huge fan of their ignore filtering behaviors when playing around with them locally. Another viable alternative would be to perform this filtering ourselves through the REST API using the /pulls/<PR #>/files endpoint.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's likely a couple of more alternatives the more I think about:

  • Run CI on every PR, regardless of content. This is the most costly option but most of the CI runs we like to skip are markdown-only PRs and most of the OLM documentation is housed in another repository.
  • Dynamically determine required checks; this would require removing required status checks entirely and updating our tide configuration to accommodate that requirement
  • Dynamically determine when to skip certain required checks (which is what this PR attempts to do)
    • Use the rest API and parse through the list of files that were changed in the PR
    • Use a custom action to perform this filtering as a job that runs before any CI-related jobs (e.g. a prerequisite job)
    • Could also play around with a workflow_dispatch singleton that triggers CI-related jobs but we'd likely run into the same issue of filtering + existing required status checks blocking PRs

@timflannagan
Copy link
Member Author

A concrete example of the current behavior between paths-ignore + branch protection policies conflicting: #2456.

@timflannagan timflannagan force-pushed the ci/dynamically-ignore-filter branch 2 times, most recently from 7a8b587 to 0c8a715 Compare November 30, 2021 00:04
@timflannagan
Copy link
Member Author

/wip

@timflannagan timflannagan added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 30, 2021
@openshift-ci openshift-ci bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 3, 2021
Update the relevant set of workflows defined in the .github/workflows
directory and avoid running the CI-related jobs when PRs only contain
markdown-only changes.

Previously, this functionality was achieved through the paths_ignore
workflow syntax, but that keyword doesn't play well with repositories
that have setup explicit required action context's through branch
protection. This results in documentation-only PRs with the requisite
labels present being gated as those skipped jobs are reported as unknown
checks and automatic merging tooling cannot perform the merge.

See [1] for more information on this behavior.

[1] https://i.8713187.xyzmunity/t/path-filtering-on-required-pull-request-checks/18402/3

Signed-off-by: timflannagan <[email protected]>
@timflannagan timflannagan force-pushed the ci/dynamically-ignore-filter branch from 0c8a715 to 6c74864 Compare December 3, 2021 18:06
@openshift-ci openshift-ci bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 3, 2021
@timflannagan timflannagan reopened this Dec 3, 2021
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 3, 2021
@timflannagan timflannagan deleted the ci/dynamically-ignore-filter branch December 7, 2021 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant