Skip to content

try to fix issues where cargo test failures on Windows runners don't fail the CI job #910

try to fix issues where cargo test failures on Windows runners don't fail the CI job

try to fix issues where cargo test failures on Windows runners don't fail the CI job #910

Workflow file for this run

name: Label Checker
on:
pull_request:
branches: main
types: [opened, labeled, unlabeled, synchronize, reopened]
permissions:
pull-requests: read
contents: read
jobs:
check-labels:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check for specific labels
run: |
# ignore dependabot PRs
if [[ ${{ github.actor }} == "dependabot[bot]" ]]; then
echo "Ignoring dependabot PRs."
exit 0
fi
# Fetch repository labels from the GitHub API
REPO_LABELS=$(gh api repos/${{ github.repository }}/labels --jq '.[].name')
# Fetch labels applied to the current PR
PR_NUMBER=${{ github.event.pull_request.number }}
PR_LABELS=$(gh pr view $PR_NUMBER --json labels -q '.labels.[] | .name')
# Check if any PR label matches a repository label
for PR_LABEL in $PR_LABELS; do
if echo "$REPO_LABELS" | grep -qw "$PR_LABEL"; then
echo "Label '$PR_LABEL' matches a repository label."
exit 0
fi
done
echo "None of the PR labels match repository labels."
exit 1
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}