Alert users about incomplete release PRs #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Validate Release | ||
on: | ||
workflow_call: | ||
inputs: | ||
valid-release-title-patterns: | ||
description: "Validate that the name of the release commit or PR starts with a string in this comma-separated list. Use '[version]' to refer to the current release version." | ||
required: false | ||
jobs: | ||
validate-release: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
RELEASE_VALIDATION_RESULT: ${{ steps.validate-release.outputs.RELEASE_VALIDATION_RESULT }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.sha }} | ||
# We need the latest commit and one before it so we can compare them | ||
fetch-depth: 2 | ||
- name: Validate release | ||
id: validate-release | ||
run: | | ||
case "$GITHUB_EVENT_NAME" in | ||
push) | ||
yarn ts-node scripts/validate-release.ts "$GITHUB_EVENT_NAME" "$GITHUB_EVENT_BEFORE" "$GITHUB_SHA" "$GITHUB_EVENT_HEAD_COMMIT_MESSAGE" "$VALID_RELEASE_TITLE_PATTERNS" | ||
;; | ||
pull_request) | ||
yarn ts-node scripts/validate-release.ts "$GITHUB_EVENT_NAME" "$GITHUB_BASE_REF" "$GITHUB_SHA" "$GITHUB_EVENT_PULL_REQUEST_TITLE" "$VALID_RELEASE_TITLE_PATTERNS" | ||
;; | ||
*) | ||
echo "Unknown GitHub event name: $GITHUB_EVENT_NAME" | ||
exit 1 | ||
esac | ||
shell: bash | ||
env: | ||
GITHUB_EVENT_BEFORE: ${{ github.event.before }} | ||
GITHUB_EVENT_HEAD_COMMIT_MESSAGE: ${{ github.event.head_commit.message }} | ||
GITHUB_EVENT_PULL_REQUEST_TITLE: ${{ github.event.pull_request.title }} | ||
VALID_RELEASE_TITLE_PATTERNS: ${{ inputs.valid-release-title-patterns }} |