Skip to content

docs: release template #243

docs: release template

docs: release template #243

Workflow file for this run

name: PR - Assign and check labels
on:
pull_request:
types:
- opened
- reopened
- edited
- synchronize
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
assign_labels:
name: Assign SemVer labels
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: ⤵️ Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get commit messages
id: commit_messages
run: |
PR_NUMBER="${{ github.event.pull_request.number }}"
COMMIT_MESSAGES=$(curl -sSL -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/pulls/${PR_NUMBER}/commits" | \
jq -r '.[].commit.message')
echo "$COMMIT_MESSAGES" > COMMIT_MESSAGES
echo "$COMMIT_MESSAGES"
- name: Determine SemVer level
id: semver_level
run: |
labels=$(python .github/scripts/pr_extract_labels.py)
echo Labels: $labels
echo "labels=$labels" >> "$GITHUB_OUTPUT"
- name: Delete commit messages file
run: |
rm COMMIT_MESSAGES
- name: Assign SemVer label
uses: actions/github-script@v7
with:
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ${{ steps.semver_level.outputs.labels }}
});
check_semver_labels:
name: Check Semver labels in PR
needs: assign_labels
runs-on: "ubuntu-latest"
steps:
- name: Check for Semver labels
uses: danielchabr/[email protected]
with:
hasSome: major,minor,patch
githubToken: ${{ secrets.GITHUB_TOKEN }}