https://github.com/lyubick/action-branch-protection
Action to change branch protection rules
https://github.com/lyubick/action-branch-protection
Last synced: 2 months ago
JSON representation
Action to change branch protection rules
- Host: GitHub
- URL: https://github.com/lyubick/action-branch-protection
- Owner: lyubick
- License: mit
- Created: 2024-02-15T10:22:03.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-08-06T11:13:07.000Z (11 months ago)
- Last Synced: 2025-03-25T23:34:54.877Z (3 months ago)
- Language: Python
- Size: 21.5 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Modify Branch Protection Rules
## Overview
This action can modify specified branch protection rules. Currently supported:
- Lock/unlock specific branch## Usage
To use action one can use code snippet below.
```yaml
jobs:
my_cool_locker:
runs-on: ubuntu-latest
steps:
- name: Lock branch
with:
access-token: access_token_here
repository-name: owner/repository
branch-name: cool_branch
lock: true
- name: Unlock branch
uses: lyubick/action-branch-protection@v1
with:
access-token: access_token_here
repository-name: owner/repository
branch-name: cool_branch
lock: false
```
One should provide following parameters:
- `access-token`, required, should be a valid GitHub access token, classic or fine-grained. For fine-grained token
one should use `Repository permissions -> Administration -> Read and Write`.
- `repository-name`, required, specify one's repository in a format `owner/repo`. One can use GitHub predefined variables
to get current repository `${{ github.repository }}`.
- `branch-name`, required, specify one's branch.
- `lock`, required, `true` if one wants to lock the branch and `false` otherwise.