-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add version label check for marge request (#72)
- Loading branch information
1 parent
59d7b4f
commit 0361f6e
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Restrict Merge Without Version Label | ||
|
||
on: | ||
pull_request: | ||
types: [opened, reopened, synchronize] | ||
|
||
jobs: | ||
check_version_label: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check if version label is assigned | ||
run: | | ||
PR_NUMBER=$(jq -r ".pull_request.number" "$GITHUB_EVENT_PATH") | ||
LABELS=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | ||
"https://api.github.com/repos/${{ github.repository }}/issues/${PR_NUMBER}/labels" \ | ||
| jq -r '.[].name') | ||
if [[ ! "$LABELS" =~ ^(minor|major|patch)$ ]]; then | ||
echo "Error: A version label (minor, major, or patch) is required for merging this PR." | ||
exit 1 | ||
fi | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |