File tree Expand file tree Collapse file tree 1 file changed +14
-8
lines changed
Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -14,16 +14,22 @@ jobs:
1414 - uses : actions/checkout@v4
1515 - name : Check for specific labels
1616 run : |
17- PR_NUMBER=$(echo ${{ github.event.pull_request.number }})
18- LABELS_JSON=$(gh pr view $PR_NUMBER --json labels -q '.labels.[] | .name')
19- REQUIRED_LABELS=("chore" "ignore" "breaking-change" "enhancement" "feature" "dependencies" "bug" "security" "performance" "refactor" "testing" "documentation" "github-actions")
20- for REQUIRED_LABEL in "${REQUIRED_LABELS[@]}"; do
21- if echo "$LABELS_JSON" | grep -q "$REQUIRED_LABEL"; then
22- echo "One of the required labels is present"
17+ # Fetch repository labels from the GitHub API
18+ REPO_LABELS=$(gh api repos/${{ github.repository }}/labels --jq '.[].name')
19+
20+ # Fetch labels applied to the current PR
21+ PR_NUMBER=${{ github.event.pull_request.number }}
22+ PR_LABELS=$(gh pr view $PR_NUMBER --json labels -q '.labels.[] | .name')
23+
24+ # Check if any PR label matches a repository label
25+ for PR_LABEL in $PR_LABELS; do
26+ if echo "$REPO_LABELS" | grep -qw "$PR_LABEL"; then
27+ echo "Label '$PR_LABEL' matches a repository label."
2328 exit 0
2429 fi
2530 done
26- echo "None of the required labels are present"
31+
32+ echo "None of the PR labels match repository labels."
2733 exit 1
2834 env :
29- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
35+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
You can’t perform that action at this time.
0 commit comments