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: Auto Label #142

Merged
merged 28 commits into from
Jun 19, 2024
Merged
Changes from 2 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
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
37 changes: 37 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Label PR with LGTM on approval

on:
pull_request_review:
types: [submitted]

jobs:
label_on_approve:
runs-on: ubuntu-latest

steps:
- name: Check if review is approved
id: review_check
run: |
if [[ "${{ github.event.review.state }}" == "approved" ]]; then
echo "::set-output name=review_approved::true"
else
echo "::set-output name=review_approved::false"
echo "This review is not an approval. Exiting."
exit 0
fi

- name: Add LGTM label
if: steps.review_check.outputs.review_approved == 'true'
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { owner, repo } = context.repo;
const pr_number = context.payload.pull_request.number;

await github.issues.addLabels({
owner,
repo,
issue_number: pr_number,
labels: ['lgtm']
});
Loading