2023-03-22 13:17:19 +00:00
|
|
|
# Copyright (c) HashiCorp, Inc.
|
|
|
|
# SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
2021-02-26 21:29:49 +00:00
|
|
|
# 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 associated with a PR for a changelog entry
|
|
|
|
|
2022-05-20 23:06:35 +00:00
|
|
|
name: Changelog Checker
|
|
|
|
|
2021-02-26 21:29:49 +00:00
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
types: [opened, synchronize, labeled]
|
2021-06-29 21:04:24 +00:00
|
|
|
# Runs on PRs to main and all release branches
|
2021-02-26 21:29:49 +00:00
|
|
|
branches:
|
2021-06-29 21:04:24 +00:00
|
|
|
- main
|
2021-02-26 21:29:49 +00:00
|
|
|
- release/*
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
# checks that a .changelog entry is present for a PR
|
|
|
|
changelog-check:
|
2022-05-03 21:17:32 +00:00
|
|
|
# If there a `pr/no-changelog` label we ignore this check. Also, we ignore PRs created by the bot assigned to `backport-assistant`
|
2023-03-27 15:04:14 +00:00
|
|
|
if: "! ( contains(github.event.pull_request.labels.*.name, 'pr/no-changelog') || github.event.pull_request.user.login == 'hc-github-team-consul-core' )"
|
2021-02-26 21:29:49 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
2024-05-14 19:49:03 +00:00
|
|
|
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
2021-02-26 21:29:49 +00:00
|
|
|
with:
|
|
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
|
|
fetch-depth: 0 # by default the checkout action doesn't checkout all branches
|
|
|
|
- name: Check for changelog entry in diff
|
2023-03-27 15:04:14 +00:00
|
|
|
run: ./.github/scripts/changelog_checker.sh
|
|
|
|
env:
|
|
|
|
GITHUB_BASE_REF: ${{ github.event.pull_request.base.ref }}
|
|
|
|
GITHUB_DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
|
|
|
|
PR_NUMBER: ${{ github.event.pull_request.number }}
|