Skip to content

Commit 1a6f447

Browse files
committed
chore: add github action that generates Gateway changelog (and plugins)
1 parent 42050e2 commit 1a6f447

File tree

1 file changed

+119
-0
lines changed

1 file changed

+119
-0
lines changed
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
name: Generate Gateway and Plugins Changelogs
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Gateway version to generate changelog for (e.g., 3.10.0.2). Leave empty to generate for all versions.'
8+
required: true
9+
type: string
10+
kong_ee_branch:
11+
description: 'Branch to use from kong-ee repository'
12+
required: true
13+
default: 'main'
14+
type: string
15+
release_date:
16+
description: 'Release date for the version (YYYY/MM/DD format). Only used when version is specified.'
17+
required: true
18+
type: string
19+
20+
permissions:
21+
contents: write
22+
pull-requests: write
23+
24+
jobs:
25+
generate-changelogs:
26+
name: Generate Gateway and Plugins Changelogs
27+
runs-on: ubuntu-latest
28+
timeout-minutes: 30
29+
steps:
30+
- name: Harden Runner
31+
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
32+
with:
33+
egress-policy: audit
34+
35+
- name: Checkout developer.konghq.com
36+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
37+
with:
38+
token: ${{ secrets.PAT }}
39+
40+
- name: Setup Node.js
41+
uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3
42+
with:
43+
node-version: '18'
44+
cache: 'npm'
45+
cache-dependency-path: |
46+
tools/changelog-generator/package-lock.json
47+
tools/plugins-changelog-generator/package-lock.json
48+
49+
- name: Install changelog generator dependencies
50+
run: |
51+
cd tools/changelog-generator
52+
npm ci
53+
cd ../plugins-changelog-generator
54+
npm ci
55+
56+
- name: Checkout kong-ee repository
57+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
58+
with:
59+
repository: 'Kong/kong-ee'
60+
token: ${{ secrets.PAT }}
61+
path: 'kong-ee'
62+
ref: ${{ inputs.kong_ee_branch }}
63+
64+
- name: Clear temp directory
65+
run: |
66+
cd tools/changelog-generator
67+
rm -rf tmp
68+
mkdir -p tmp
69+
70+
- name: Generate changelog for specific version
71+
if: ${{ inputs.version != '' }}
72+
run: |
73+
cd tools/changelog-generator
74+
node run.js --path='../../kong-ee' --version='${{ inputs.version }}'
75+
76+
- name: Update release date in gateway.yml
77+
run: |
78+
sed -i "/^release_dates:/a\\ '${{ inputs.version }}': ${{ inputs.release_date }}" app/_data/products/gateway.yml
79+
80+
- name: Generate/update changelog file
81+
run: |
82+
cd tools/changelog-generator
83+
node changelog.js
84+
85+
- name: Generate plugins changelogs
86+
run: |
87+
cd tools/plugins-changelog-generator
88+
node run.js --version='${{ inputs.version }}'
89+
90+
- name: Check for changes
91+
id: changes
92+
run: |
93+
if git diff --quiet; then
94+
echo "changed=false" >> $GITHUB_OUTPUT
95+
else
96+
echo "changed=true" >> $GITHUB_OUTPUT
97+
fi
98+
99+
- name: Create pull request
100+
if: steps.changes.outputs.changed == 'true'
101+
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7
102+
with:
103+
title: Generate Gateway and plugins changelogs for version ${{ inputs.version }}
104+
commit-message: Generate Gateway and plugins changelogs for version ${{ inputs.version }}
105+
body: |
106+
**Changes:**
107+
- Generated changelog entries for Gateway
108+
- Generated changelog entries for plugins
109+
${{format('- Updated changelog for Gateway version {0}', inputs.version)}}
110+
${{format('- Set release date for version {0} to {1}', inputs.version, inputs.release_date)}}
111+
112+
labels: skip-changelog,review:general
113+
token: ${{ secrets.PAT }}
114+
branch: auto/generate-gateway-plugins-changelogs-${{ github.run_number }}
115+
116+
- name: No changes detected
117+
if: steps.changes.outputs.changed == 'false'
118+
run: |
119+
echo "No changes detected in the changelog files. No pull request will be created."

0 commit comments

Comments
 (0)