Skip to content

Test action label checker #43

Test action label checker

Test action label checker #43

Workflow file for this run

---
name: Label Checker
on:
pull_request:
types:
- opened
- synchronize
- reopened
- labeled
- unlabeled
jobs:
check_labels:
name: Check labels
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Get PR labels
id: pr-labels
uses: ./ # Uses an action in the root directory
- run: |
env | grep GITHUB_PR_LABEL || true
- run: |
echo "hasValidLabels=false" >> "$GITHUB_ENV"
if: |
(!contains(steps.pr-labels.outputs.labels, ' enhancement '))
- name: Comment if missing labels
id: pr_comment
if: ${{ steps.pr_check_label.outputs.hasValidLabels == false }}
uses: actions/github-script@v4
with:
script: |
// Post a warning comment
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: ':warning: :warning: :warning:<br>@'+context.repo.owner+' your PR does not include any descriptive label :label:<br> Make sure to add an appropriate [PR label](https://github.com/sofa-framework/sofa/labels) before merge.<br>:warning: :warning: :warning:'
});
github-token: ${{ secrets.GITHUB_TOKEN }}