-
Notifications
You must be signed in to change notification settings - Fork 30
70 lines (57 loc) · 2.43 KB
/
update.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
on:
push:
paths:
- 'api-specs/**'
workflow_dispatch:
name: Update RAML
permissions:
contents: write # for stefanzweifel/git-auto-commit-action to push code in repo
jobs:
generate:
name: "Update RAML spec"
runs-on: ubuntu-latest
steps:
# Get GitHub token via the CT SDKs App
- name: Generate GitHub token (via CT SDKs App)
id: generate_github_token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.CT_SDKS_APP_ID }}
private-key: ${{ secrets.CT_SDKS_APP_PEM }}
owner: ${{ github.repository_owner }}
- name: Get App user
id: get_app_user
env:
GITHUB_TOKEN: ${{ steps.generate_github_token.outputs.token }}
run: |
export GH_APP_USER=`gh api /users/ct-sdks%5Bbot%5D | jq .id`
echo "email=${GH_APP_USER}+ct-sdks[bot]@users.noreply.github.com" >> "$GITHUB_OUTPUT"
- name: "Checkout"
uses: actions/checkout@v4
with:
# Pass a personal access token (using our CT SDKs App) to be able to trigger other workflows
# https://help.github.com/en/actions/reference/events-that-trigger-workflows#triggering-new-workflows-using-a-personal-access-token
# https://github.community/t/action-does-not-trigger-another-on-push-tag-action/17148/8
token: ${{ steps.generate_github_token.outputs.token }}
- name: 'Setup Java'
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: '16'
- run: sudo chmod 777 /usr/local/bin && make generate lint
if: github.ref != 'refs/heads/main'
- run: sudo chmod 777 /usr/local/bin && make build
if: github.ref == 'refs/heads/main'
- run: sudo chmod 777 /usr/local/bin && make generate_bruno
if: github.ref == 'refs/heads/main'
continue-on-error: true
- name: "check pending changes"
run: echo "CHANGES_PENDING=`git status --porcelain -- ':(exclude)*gen.properties' | grep -c ^`" >> $GITHUB_ENV
- uses: stefanzweifel/git-auto-commit-action@v4
if: env.CHANGES_PENDING != '0'
with:
commit_message: "TASK: Updating RAML types, Postman and OAS definition"
file_pattern: oas uml bruno
commit_author: ct-sdks[bot] <${{ steps.get_app_user.outputs.email }}>
commit_user_name: ct-sdks[bot]
commit_user_email: ${{ steps.get_app_user.outputs.email }}