This repository has been archived by the owner on Mar 19, 2024. It is now read-only.
Update README.md #2141
Workflow file for this run
This file contains 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
# This workflow checks that there is either a 'pr/no-changelog' label applied to a PR | |
# or there is a .changelog/<pr_number>.txt file containing a changelog entry with | |
# one or more valid changelog notes | |
name: changelog | |
on: | |
pull_request: | |
types: [opened, synchronize, labeled] | |
# Runs on PRs to main and all release branches | |
branches: | |
- main | |
- release/* | |
jobs: | |
validate: | |
# If there a `pr/no-changelog` label we ignore this check | |
if: "!contains(github.event.pull_request.labels.*.name, 'pr/no-changelog')" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: 0 # by default the checkout action doesn't checkout all branches | |
- uses: ./.github/actions/goenv | |
with: | |
go-version: '1.19' | |
- name: Check for changelog entry in diff | |
run: | | |
pull_request_base_main=$(expr "${{ github.event.pull_request.base.ref }}" = "main") | |
# For PRs against the main branch, the changelog file name should match | |
# the PR number | |
if [ pull_request_base_main ]; then | |
enforce_matching=1 | |
changelog_file_path=".changelog/${{ github.event.pull_request.number }}.txt" | |
else | |
changelog_file_path=".changelog/*(_)+([[:digit:]]).txt" | |
fi | |
# Fail status check if non-zero exit code is returned | |
./scripts/changelog-check.sh ${changelog_file_path} ${enforce_matching} |