Skip to content

Commit

Permalink
Merge pull request #39 from ichoosetoaccept/fix/add-release-label
Browse files Browse the repository at this point in the history
add: automatic release label workflow
  • Loading branch information
ichoosetoaccept authored Dec 15, 2024
2 parents 9c64339 + 14dc400 commit 943e014
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/auto-label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Auto Label Release PRs

on:
pull_request:
types: [opened, synchronize]
branches: [main]

jobs:
auto-label:
runs-on: ubuntu-latest
permissions:
pull-requests: write

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Check commit messages and add label
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
# Get all commit messages in the PR
commits=$(gh pr view $PR_NUMBER --json commits --jq '.commits[].messageHeadline')
# Check if any commit message starts with "release:"
if echo "$commits" | grep -q "^release:"; then
gh pr edit $PR_NUMBER --add-label "release"
fi

0 comments on commit 943e014

Please sign in to comment.