Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Add the label-check workflow to verify changelog labels on each PR #4847

Merged
merged 8 commits into from
Oct 16, 2023
Merged
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/ci-label-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Verify PR Label

on:
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
- labeled
- unlabeled

jobs:
check-label:
runs-on: ubuntu-latest
steps:
- name: Check PR author
id: check_author
run: echo "::set-output name=is_dependabot::$(echo ${{ github.event.pull_request.user.login }} | grep -o 'dependabot')"

- name: Check PR label
if: steps.check_author.outputs.is_dependabot != 'dependabot'
run: |
LABEL_NAME="changelog:"
if [[ $(curl -s "https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}" | jq -r '.labels[].name' | grep -c "^$LABEL_NAME") -eq 0 ]]; then
echo "Error: Missing required label $LABEL_NAME on this pull request."
anshgoyalevil marked this conversation as resolved.
Show resolved Hide resolved
exit 1
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}