Skip to content

JustinDFuller/github-action-lock-branch

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Github Action Lock Branch

This Github Action locks or unlocks a branch using Branch Protection Rules.

It is useful for automating the locking of a branch, particularly when paired with Github Action Scheduler.

Usage

You can find a working demo in .github/workflows/demo.yml.

Here is a demo for locking a branch.

- name: Lock branch
  id: lock
  uses: JustinDFuller/github-action-lock-branch@v1
  with:
    lock: true ## required
    token: ${{ secrets.LOCK_TOKEN }} # required
    owner: JustinDFuller # optional
    repository: github-action-lock-branch # optional
    branch: main # optional

Here is a demo for unlocking a branch.

- name: Lock branch
  id: lock
  uses: JustinDFuller/github-action-lock-branch@v1
  with:
    lock: false ## required
    token: ${{ secrets.LOCK_TOKEN }} # required
    owner: JustinDFuller # optional
    repository: github-action-lock-branch # optional
    branch: main # optional

Here is a demo for inferring the current owner, repo, and branch.

- name: Lock branch
  id: lock
  uses: JustinDFuller/github-action-lock-branch@v1
  with:
    lock: false ## required
    token: ${{ secrets.LOCK_TOKEN }} # required

Token Requirements

The token must be a token with Write permissions for Administration.

  1. Go to Settings.
  1. Go to Developer Settings.
  1. Go to Personal Access Tokens -> Fine Grained Tokens.
  1. Set Administration to Read/Write.

About

Github Action to Lock a Branch

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •