Skip to content

Update Labels

Update Labels #41

Workflow file for this run

name: CI
on:
pull_request:
jobs:
label-check:
runs-on: ubuntu-latest
outputs:
chosen_label: ${{ steps.determine_label.outputs.chosen_label }}
steps:
- name: Write PR Body to File
id: write_body
run: |
# Write the entire PR description into a file
cat <<EOF > pr_body.txt ${{ github.event.pull_request.body }} EOF
- name: Determine Single Label
id: determine_label
run: |
label=""
# 1) Bugfix
if grep -qE '^- \\[x\\] Bugfix \\(fixed change that fixes an issue\\)' pr_body.txt; then
label="bugfix"
# 2) New feature
elif grep -qE '^- \\[x\\] New feature \\(thanks!\\)' pr_body.txt; then
label="new-feature"
# 3) Breaking change
elif grep -qE '^- \\[x\\] Breaking change \\(repair/feature that breaks existing functionality\\)' pr_body.txt; then
label="breaking-change"
fi
echo "chosen_label=$label" >> $GITHUB_OUTPUT
- name: Apply Single Label
if: ${{ steps.determine_label.outputs.chosen_label != '' }}
uses: actions-ecosystem/action-add-labels@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
labels: ${{ steps.determine_label.outputs.chosen_label }}
ci:
runs-on: ubuntu-latest
needs: [ label-check ]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Your build steps
run: |
echo "Building or testing..."