-
Notifications
You must be signed in to change notification settings - Fork 80
86 lines (73 loc) · 2.14 KB
/
generate.yml
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
name: Generate Output
on:
push:
branches:
- 'main'
- '7.17'
- '8.[0-9]+'
# For debugging purposes:
# pull_request:
# types: [opened, synchronize, reopened]
# branches:
# - main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
defaults:
run:
shell: bash
jobs:
build:
runs-on: ubuntu-latest
# The actor check currently does not work. The `secrets.PAT` belongs to `delvedor` and not
# `elasticmachine`. We should make sure to change this in the future.
if: github.repository_owner == 'elastic' && github.actor != 'elasticmachine'
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.PAT }}
persist-credentials: true
- name: Setup Node 20
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: '**/package-lock.json'
- name: Setup Dependencies
run: |
make setup
- name: Generate Output
run: |
make compile
make generate
make transform-to-openapi
make filter-for-serverless
- name: Check for Changed Files
id: changes
run: |
if [ -n "$(git status --porcelain ./output)" ]; then
echo "has-changes=1" >> $GITHUB_OUTPUT
fi
- name: Set Git Identity
if: steps.changes.outputs.has-changes == '1'
run: |-
git config --global user.email "[email protected]"
git config --global user.name "Elastic Machine"
- name: Push Output
if: steps.changes.outputs.has-changes == '1'
run: |
git add -A ./output
git commit -m "Update specification output"
git push
# For debugging purposes:
# - name: Push Output
# if: steps.changes.outputs.has-changes == '1'
# env:
# BRANCH_NAME: output_${{ github.run_id }}_${{ github.run_attempt }}
# run: |
# git fetch
# git switch main
# git add -A ./output
# git commit -m "Update specification output"
# git push origin HEAD:refs/heads/${{ env.BRANCH_NAME }}