-
-
Notifications
You must be signed in to change notification settings - Fork 20
114 lines (98 loc) · 3.58 KB
/
Copy pathgenerate.yml
File metadata and controls
114 lines (98 loc) · 3.58 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
---
name: Generate Code from AWS documentation
on:
schedule:
# Why 1:57 not and 2:00? Because most hourly jobs probably run at the hour.
# Keeping concurrent jobs low reduces hardware requirements, being nice to
# GitHub and the environment.
- cron: 57 1 * * *
workflow_dispatch:
inputs:
command:
description: make command to run
required: true
default: generate
type: choice
options:
- generate
- generate-force
jobs:
generate:
runs-on: ubuntu-latest
steps:
- name: Setup node
uses: actions/setup-node@v6
with:
node-version: 24.x
- name: Checkout code
uses: actions/checkout@v6
with:
persist-credentials: false
fetch-depth: 0
- name: Install dependencies
run: make install
- name: Generate code
run: make generate
if: ${{ github.event_name == 'schedule' }}
- name: Generate code
run: make ${{ github.event.inputs.command }}
if: ${{ github.event_name == 'workflow_dispatch' }}
- name: Check for changes # we expect at least 3 changes or we won't trigger a new release
id: changes
run: |
set -xuo pipefail # we intentionally do not use -e here, as rc=1 means we have changes
git diff
echo "CHANGED=$(git diff --unified=0 -- stats | grep '^[+-]' | grep -v +++ | grep -v -- --- | wc -l | xargs)" >> $GITHUB_OUTPUT
# fail if the index file does not exist.
# this could happen if we cannot reach the AWS documentation, or the
# format of the documentation has changed and therefore cannot generate
# code.
- name: Failsafe
run: test -e lib/index.ts || exit 1
if: steps.changes.outputs.CHANGED >= 3
- name: Configure git
run: |
set -xeuo pipefail
git config --local user.email "${{ secrets.RELEASE_MAIL }}"
git config --local user.name "udondan"
if: steps.changes.outputs.CHANGED >= 3
- name: Update version refs
run: |
set -xeuo pipefail
perl -pi -e 's/^(\d+\.)(\d+)(\.\d+)$/($1).($2+1).".0"/e' VERSION
make update-version-refs
if: steps.changes.outputs.CHANGED >= 3
- name: Update stats in documentation
run: make stats
if: steps.changes.outputs.CHANGED >= 3
- name: Generate changelog for next release
run: |
set -xeuo pipefail
make changelog
git add CHANGELOG/*
if: steps.changes.outputs.CHANGED >= 3
- name: Regenerate code example results
run: make regenerate-code-example-results
if: steps.changes.outputs.CHANGED >= 3
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Add all changes
run: |
set -xeuo pipefail
rm -rf package-lock.json node_modules *.tsbuildinfo &&
git add *
if: steps.changes.outputs.CHANGED >= 3
- name: Create Pull Request
uses: peter-evans/create-pull-request@v8
with:
token: ${{ secrets.OVERRIDE_TOKEN }}
commit-message: Adds latest IAM updates from AWS
title: Adds latest IAM updates from AWS
body: Adds latest IAM updates from AWS
branch: iam-updates
delete-branch: true
committer: udondan <${{ secrets.RELEASE_MAIL }}>
author: udondan <${{ secrets.RELEASE_MAIL }}>
labels: automerge
if: steps.changes.outputs.CHANGED >= 3