Skip to content
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

first pass at adding a github workflow to lock the b4b-dev branhc #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/b4b-dev-auto-lock.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Lock b4b-dev branch

on:
schedule:
- cron: '30 23 * * SUN'
workflow_dispatch:

jobs:
lock-branch:
runs-on: ubuntu-latest
steps:
- name: Lock b4b-dev branch
# curl command and REST data explanation
# -L: make curl follow a redirect to the location
# -X PUT: send "PUT" request
# -H Authorization: pass github "Authorization" header
# -H Accept: pass github "Accept" head
# -d: data to send
# required_status_checks: force branch to be up to date with base before merging
# enforce_admins: enforce all configurations given for admins
# required_pull_request_reviews: set PR requirements for merging
# restrictions: who can push to protected branch (users, teams, apps)
# allow_force_pushes
# allow_deletions
# lock_branch
run: |
curl -L \
-X PUT \
-H "Authorization: token ${{ secrets.REPO_ACCESS_TOKEN }}" \
-H "Accept: application/vnd.github+json" \
https://api.github.com/repos/${{ github.repository }}/branches/b4b-dev/protection \
-d '{
"required_status_checks": strict,
"enforce_admins": null,
"required_pull_request_reviews": {
"required_approving_review_count": 1
},
"restrictions": {
"users": ["glemieux"],
"teams": []
},
"allow_force_pushes": false,
"allow_deletions": false,
"lock_branch": true
}'
env:
REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
Loading