Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cirrus-actions/branch-guard
Action to guard branches from merges when any of the latest check suites or commit statuses is failing.
https://github.com/cirrus-actions/branch-guard
github-actions
Last synced: 6 days ago
JSON representation
Action to guard branches from merges when any of the latest check suites or commit statuses is failing.
- Host: GitHub
- URL: https://github.com/cirrus-actions/branch-guard
- Owner: cirrus-actions
- License: mit
- Archived: true
- Created: 2020-01-27T19:57:58.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-03-16T05:03:00.000Z (over 4 years ago)
- Last Synced: 2024-10-26T11:38:10.334Z (13 days ago)
- Topics: github-actions
- Language: TypeScript
- Size: 443 KB
- Stars: 6
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-actions - Block PR merges when Checks for target branches are failing
- fucking-awesome-actions - Block PR merges when Checks for target branches are failing
- awesome-workflows - Block PR merges when Checks for target branches are failing
README
# Deprecated
In favor of a more suphesicated GitHub App. See https://github.com/cirruslabs/gh-submit-queue
# Block PR merges when Checks for target branches are failing 🔓
![](demo.png)
Create following `.github/workflows/branch-guard.yml` that will block PRs from merging when the latest [Check Suite](https://developer.github.com/v3/checks/)
starts failing and unblock once it's passing again:```yaml
on:
pull_request: # to update newly open PRs or when a PR is synced
check_suite: # to update all PRs upon a Check Suite completion
type: ['completed']
name: Branch Guard
jobs:
branch-guard:
name: Branch Guard
if: github.event.check_suite.head_branch == 'master' || github.event.pull_request.base.ref == 'master'
runs-on: ubuntu-latest
steps:
- uses: cirrus-actions/[email protected]
with:
appsToCheck: Cirrus CI # or any other App name (can be a comma separated list of names)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```**Disclaimer:** Action doesn't fully work on PRs from forks since GitHub Actions for such PRs have only read permissions and can't update the status checks. Please remove `pull_request` line from `branch-guard.yml` to mitigate the issue,