-
Notifications
You must be signed in to change notification settings - Fork 85
118 lines (103 loc) · 3.83 KB
/
generate-kong-conf-json.yml
File metadata and controls
118 lines (103 loc) · 3.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
name: Generate Kong Configuration JSON
on:
workflow_dispatch:
inputs:
version:
description: 'Kong version to generate config for (e.g., 3.9)'
required: true
type: string
kong_ee_branch:
description: 'Branch to use from kong-ee repository'
required: true
default: 'main'
type: string
dev_site_base_branch:
description: 'Dev site base branch, e.g. main'
required: true
type: string
kong_conf_path:
description: 'Path to kong.conf file in kong-ee repo (relative to repo root)'
required: false
default: 'kong.conf.default'
type: string
permissions:
contents: write
pull-requests: write
jobs:
generate-kong-conf-json:
name: Generate Kong Configuration JSON
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Harden Runner
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
with:
egress-policy: audit
- name: Create GitHub App Token
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf
id: app-token
with:
app-id: ${{ vars.GH_APP_KONG_DOCS_ID }}
private-key: ${{ secrets.GH_APP_KONG_DOCS_SECRET }}
owner: Kong
- name: Checkout developer.konghq.com
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
with:
token: ${{ steps.app-token.outputs.token }}
- name: Setup Node.js
uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610 # v3
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: tools/kong-conf-to-json/package-lock.json
- name: Install kong-conf-to-json dependencies
run: |
cd tools/kong-conf-to-json
npm ci
- name: Checkout kong-ee repository
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
with:
repository: 'Kong/kong-ee'
token: ${{ steps.app-token.outputs.token }}
path: 'kong-ee'
ref: ${{ inputs.kong_ee_branch }}
- name: Create kong-conf data directory
run: |
mkdir -p app/_data/kong-conf
- name: Generate kong.conf JSON
run: |
cd tools/kong-conf-to-json
node run.js --file="../../kong-ee/${{ inputs.kong_conf_path }}" --version="${{ inputs.version }}"
- name: Generate index file
run: |
cd tools/kong-conf-to-json
node index-file.js
- name: Check for changes
id: changes
run: |
if git diff --quiet; then
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Create pull request
if: steps.changes.outputs.changed == 'true'
uses: peter-evans/create-pull-request@22a9089034f40e5a961c8808d113e2c98fb63676 # v7
with:
title: Generate Kong configuration JSON for version ${{ inputs.version }}
commit-message: Generate Kong configuration JSON for version ${{ inputs.version }}
body: |
**Changes:**
- Generated JSON representation of kong.conf file
- Updated kong-conf index file with version information
- Processed Kong version ${{ inputs.version }}
labels: skip-changelog,review:general
token: ${{ steps.app-token.outputs.token }}
branch: auto/generate-kong-conf-json-${{ github.run_number }}
base: ${{ inputs.dev_site_base_branch }}
add-paths: |
app/**
- name: No changes detected
if: steps.changes.outputs.changed == 'false'
run: |
echo "No changes detected in the kong-conf JSON files. No pull request will be created."