From 248920283ab5360990bdb369585ad7b693ccfa99 Mon Sep 17 00:00:00 2001 From: Yusheng Li Date: Wed, 20 Sep 2023 17:14:41 +0800 Subject: [PATCH] chore(changelog): use reusable changelog workflow (#11549) This avoids code duplication and makes improvements on changelog generation/format easier. --- .github/workflows/changelog-requirement.yml | 32 +++++++++++++++++++++ .github/workflows/changelog-validation.yml | 17 +++++++++++ 2 files changed, 49 insertions(+) create mode 100644 .github/workflows/changelog-requirement.yml create mode 100644 .github/workflows/changelog-validation.yml diff --git a/.github/workflows/changelog-requirement.yml b/.github/workflows/changelog-requirement.yml new file mode 100644 index 000000000000..7bbc02a32a38 --- /dev/null +++ b/.github/workflows/changelog-requirement.yml @@ -0,0 +1,32 @@ +name: Changelog Requirement + +on: + pull_request: + types: [ opened, synchronize, labeled, unlabeled ] + paths: + - 'kong/**' + - '**.rockspec' + - '.requirements' + +jobs: + require-changelog: + if: ${{ !contains(github.event.*.labels.*.name, 'skip-changelog') }} + name: Requires changelog + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 2 + + - name: computes changed files + id: changelog-check + uses: tj-actions/changed-files@2f7246cb26e8bb6709b6cbfc1fec7febfe82e96a # v37 + with: + files: 'CHANGELOG/unreleased/**/*.yaml' + + - name: asserts changelog added + run: > + if [ "${{ steps.changelog-check.outputs.added_files_count }}" = "0" ]; then + echo "Should contain at least one changelog file in CHANGELOG/unreleased/*/ directory" + exit 1 + fi diff --git a/.github/workflows/changelog-validation.yml b/.github/workflows/changelog-validation.yml new file mode 100644 index 000000000000..7590fca8928d --- /dev/null +++ b/.github/workflows/changelog-validation.yml @@ -0,0 +1,17 @@ +name: Changelog Validation + +on: + pull_request: + types: [ opened, synchronize ] + +jobs: + validate-changelog: + name: Validate changelog + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Validate changelogs + uses: Kong/gateway-changelog@main + with: + files: CHANGELOG/unreleased/*/*.yaml