Skip to content

Commit

Permalink
chore: Added handling for nonexistent labels in labeler.yml and remov…
Browse files Browse the repository at this point in the history
…ed the permission to add labels from dependabot.yml (#151)

* chore: Added handling for nonexistent labels in labeler.yml and removed the permission to add labels from dependabot.yml

* fix: Missing GH_TOKEN
  • Loading branch information
kurosakishigure authored Dec 29, 2024
1 parent 2400b47 commit 6f535a4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ updates:
schedule:
interval: daily
open-pull-requests-limit: 10
labels: [ 'dependency' ]
labels: [ ]
commit-message:
prefix: 'dep'
- package-ecosystem: github-actions
directory: '/'
schedule:
interval: daily
labels: [ 'action' ]
labels: [ ]
commit-message:
prefix: 'act'
19 changes: 19 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,22 @@ jobs:
if: ${{ startsWith(github.event.pull_request.title, 'test:') }}
with:
labels: test
- name: Add dependency label
uses: actions-ecosystem/action-add-labels@v1
if: ${{ startsWith(github.event.pull_request.title, 'dep:') }}
with:
labels: dependency
- name: Add action label
uses: actions-ecosystem/action-add-labels@v1
if: ${{ startsWith(github.event.pull_request.title, 'act:') }}
with:
labels: action
- name: Check if no label was added
run: |
labels=$(gh pr view ${{ github.event.pull_request.number }} --json labels --jq '.labels[].name')
if [ -z "$labels" ]; then
echo "No labels were added, closing the pull request."
gh pr close ${{ github.event.pull_request.number }} --comment "Closing PR: No valid prefix found in the title."
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 6f535a4

Please sign in to comment.