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 a12363a commit 22bb392
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
30 changes: 30 additions & 0 deletions .github/workflows/check-for-labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Check for Label

on:
issues:
types: [labeled]

jobs:
check-label:
runs-on: ubuntu-latest
steps:
- name: Check if label exists
id: check_label
uses: actions/github-script@v6
with:
script: |
const label = 'your-label-name';
const labels = context.payload.issue.labels.map(l => l.name);
return labels.includes(label);
- name: Set output
id: set_output
run: echo "LABEL_EXISTS=${{ steps.check_label.outputs.result }}" >> $GITHUB_ENV

- name: Label exists
if: env.LABEL_EXISTS == 'true'
run: echo "Label exists."

- name: Label does not exist
if: env.LABEL_EXISTS == 'false'
run: echo "Label does not exist."
2 changes: 1 addition & 1 deletion .github/workflows/pr-title-spell-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ jobs:
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${PR_NUMBER}/assignees \
-d '{"assignees":["${{ github.event.pull_request.user.login }}"]}'
-d '{"assignees":["${{ github.event.pull_request.user.login }}"]}'

0 comments on commit 22bb392

Please sign in to comment.