Skip to content

Commit

Permalink
fix: check labels
Browse files Browse the repository at this point in the history
  • Loading branch information
PritishBudhiraja committed Aug 18, 2024
1 parent 22bb392 commit 91b0742
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions .github/workflows/check-for-labels.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
name: Check for Label

on:
issues:
types: [labeled]
pull_request_target:
types:
- opened
- edited
- reopened
- ready_for_review
- synchronize

jobs:
check-label:
Expand All @@ -14,11 +19,17 @@ jobs:
with:
script: |
const label = 'your-label-name';
const labels = context.payload.issue.labels.map(l => l.name);
return labels.includes(label);
console.log(`Looking for label: ${label}`);
const labels = context.payload.pull_request.labels.map(l => l.name);
console.log('Labels on this pull request:', labels);
const labelExists = labels.includes(label);
console.log(`Does the label "${label}" exist?`, labelExists);
return labelExists;
- name: Set output
id: set_output
run: echo "LABEL_EXISTS=${{ steps.check_label.outputs.result }}" >> $GITHUB_ENV

- name: Label exists
Expand Down

0 comments on commit 91b0742

Please sign in to comment.