-
Notifications
You must be signed in to change notification settings - Fork 28
80 lines (80 loc) · 2.7 KB
/
client-libraries-pull-request.yaml
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
name: client-libraries-pull-request
run-name: Generate PRs to client libraries repositories
on:
push:
branches:
- master
paths-ignore:
- 'generated/artifacts/**'
pull_request:
branches:
- master
jobs:
build_client_libraries:
name: Build library with typescript-axios generator
runs-on: ubuntu-latest
strategy:
matrix:
generator: ["typescript-axios"]
outputs:
git_repo_id: ${{ steps.extract_data.outputs.gitRepoId }}
container:
image: openapitools/openapi-generator-cli:v7.3.0
env:
OPENAPI_GENERATOR_COMMAND: docker-entrypoint.sh
steps:
- uses: actions/checkout@v4
- name: Install pre-requisites
run: |
apt-get update
apt-get install -yqq \
gettext-base
- name: Refresh client library
run: |
./generator/script/generate.sh \
generator/configuration/${{ matrix.generator }}.yaml
- name: Extract target repository name
id: extract_data
run: |
grep gitRepoId generated/configuration/typescript-axios.yaml | sed 's/: /=/' >> $GITHUB_OUTPUT
- name: Store generated artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts-${{ github.workflow }}-${{ github.run_id }}-${{ github.run_number }}-${{ matrix.generator }}
path: generated/artifacts/${{ matrix.generator }}
create_pr:
name: Commit and create pull request to {{ needs.build_client_libraries.outputs.git_repo_id }} repository
runs-on: ubuntu-latest
needs: build_client_libraries
strategy:
matrix:
generator:
- typescript-axios
# if: github.event_name == 'push'
steps:
- name: Dump matrix context
env:
NEEDS_CONTEXT: ${{ toJson(needs) }}
run: echo "$NEEDS_CONTEXT"
- uses: actions/checkout@v4
with:
# token: ${{ secrets.GITHUB_ACTION_ACCESS_TOKEN }}
repository: onfido/${{ needs.build_client_libraries.outputs.git_repo_id }} #'onfido/onfido-node'
- uses: actions/download-artifact@v4
with:
name: artifacts-${{ github.workflow }}-${{ github.run_id }}-${{ github.run_number }}-${{ matrix.generator }}
path: generated/artifacts
- name: Commit and push client library update
run: |
git --version
if [ -z "$(git status --porcelain=v1)" ];
then
echo "no change detected"
else
echo "changes detected"
git config user.name "GitHub Actions Bot"
git config user.email "<>"
git status
git commit -am "Client library upgrade after OpenAPI change"
# git push
fi