Skip to content

Commit

Permalink
tools: add linter for release commit proposals
Browse files Browse the repository at this point in the history
  • Loading branch information
aduh95 committed Nov 19, 2024
1 parent 1d01ad6 commit 76bd848
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/lint-release-proposal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Linters

on:
push:
branches:
- v[0-9]+.[0-9]+.[0-9]+-proposal

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

env:
PYTHON_VERSION: '3.12'
NODE_VERSION: lts/*

permissions:
contents: read

jobs:
lint-release-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Lint release commit
run: |
git log -1 HEAD --format=%s | grep -q -E '^\d{4}-\d{2}-\d{2}, Version \d+\.\d+\.\d+ (\(Current|'.+' \(LTS)\)$'
git log -1 HEAD --format=%b | git interpret-trailers --parse --no-divider | grep -E -q "^PR-URL: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/pull/[0-9]+$"
- name: Extract releaser info
id: releaser-info
run: |
COMMIT_SUBJECT="$(git log -1 HEAD --format=%s)"
CHANGELOG_TITLE_INTRO="## $COMMIT_SUBJECT, @"
CHANGELOG_TITLE="$(grep "$CHANGELOG_TITLE_INTRO" "doc/changelogs/CHANGELOG_V${COMMIT_SUBJECT:20:2}.md")"
[[ "${CHANGELOG_TITLE%@*}@" == "$CHANGELOG_TITLE_INTRO" ]]
RELEASER_INFO="${CHANGELOG_TITLE#*@}"
{
echo "RELEASER=${RELEASER_INFO% prepared by*}"
echo "PREPARATOR=${RELEASER_INFO#*@}"
} >> "$GITHUB_OUTPUT"

0 comments on commit 76bd848

Please sign in to comment.