-
Notifications
You must be signed in to change notification settings - Fork 14
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
👷 Add a GitHub workflow to prevent blocked PRs from being merged #85
👷 Add a GitHub workflow to prevent blocked PRs from being merged #85
Conversation
To indicate that PR2 depends on PR1, add `Depends on #1` to PR2's description This GitHub workflow uses a GitHub Action to check for issues blocking a PR. The term "issue" above is misleading as it can denote another PR or a GitHub issue from the same repository. iThis syntax does not allow cross repository PR dependencies. See: - GH Action: https://github.com/Levi-Lesches/blocking-issues - Discussion about the need for such a feature in GitHub and the open-source workarounds in the meantime: https://github.com/orgs/community/discussions/4477#discussioncomment-1039627
This PR adds a GitHub Workflow to check for PRs blocked by another PR and/or issue. GitHub does not provide a way to mark a PR dependent on another PR.
While searching for open-source alternatives to fill this void, The need is twofold:
I have paraphrased above what is explained in this message: A few tools answer point 2 (i.e. avoid an incorrect merge of the child PR before the parent PR): I tried every one of them and decided to go with the
This PR adds a GitHub Workflow to check for PRs and GitHub issues blocked by another PR and/or Issue. Blocked by #1 The workflow will now prevent PR-2 from being merged before PR-1 is merged. |
Issues indentation was off.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks @MikePlante1 . ❌ The workflow failed because it could not create the |
ℹ️ For the record, the
as long as it is in Draft mode. To display the detailed the Checks logs, click the
|
Description
This PR adds a new feature to PRs in this GitHub repository.
A PR can depend on:
To indicate that PR2 depends on PR1,
add
Blocked by #1
to PR2's descriptionThis PR adds a new GitHub workflow (
.github/workflows/pr-dependencies-check.yml
) using the Levi-Lesches/blocking-issues GitHub Action.It runs each time a PR is created, updated, closed, or re-opened.
It checks if the PR is blocked.
If so it fails, preventing the PR from being merged.
⏱️ The workflow takes ~10 seconds to run.
Remarks
PR Dependent on another PR
✅ This works fine provided both PRs are in the same repository.
Cross-repository PR dependencies are not supported.
PR Dependent on an Issue
I experimented with making a PR dependent on a GitHub Issue.Based on my testing, it does not work as closing this issue does not trigger the workflow.
Therefore this dependency change is not taken into account automatically.
I needed to edit the PR description to trigger the workflow again which is not optimal!
❌ This is why, I do not recommend making a PR dependent on a GH issue.
EDIT: ✅ It now works fine. I made a mistake and the indentation was off. Now fixed.
Resources
Levi-Lesches/blocking-issues
GitHub Action: https://github.com/Levi-Lesches/blocking-issues