-
Notifications
You must be signed in to change notification settings - Fork 6
87 lines (75 loc) · 2.75 KB
/
check-custom-templates.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
81
82
83
84
85
86
87
name: Check Custom Templates
on:
workflow_dispatch:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '0 0 1 * *'
jobs:
check-custom-templates:
runs-on: ubuntu-latest
strategy:
matrix:
sdk: ['php', 'javascript', 'csharp', 'ruby', 'java', 'python', 'typescript-axios', 'go']
steps:
- id: checkout
name: Checkout repo
uses: actions/checkout@v4
with:
token: ${{ secrets.FATTUREINCLOUD_BOT_TOKEN }}
- id: init-git
name: Init GIT
run: |
git config --global user.email "info@fattureincloud.it"
git config --global user.name "fattureincloud-bot"
- id: setup-node
name: Setup Node.js
uses: actions/setup-node@v4
- id: setup-java
name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '11'
- id: setup-libraries
name: Install libraries
run: |
npm install -g yarn
yarn global add @openapitools/openapi-generator-cli
- id: retrieve-templates
name: Retrieve templates
run: |
openapi-generator-cli author template -g ${{ matrix.sdk }} -o templates-temp/openapi-generator/${{ matrix.sdk }}
for entry in "templates-temp/openapi-generator/${{ matrix.sdk }}"/*; do
echo "Found template $entry"
if ["${{ matrix.sdk }}" == "java"]; then
FILE="${entry/templates-temp/templates/libraries/okhttp-gson}"
else
FILE="${entry/templates-temp/templates}"
fi
echo "Checking if $FILE exists..."
if test -f "$FILE"; then
echo "Moving $entry to $FILE"
mv $entry $FILE
fi
done
rm -rf templates-temp/openapi-generator/${{ matrix.sdk }}
cd templates/openapi-generator/${{ matrix.sdk }}
git add .
- id: get-timestamp
name: Get Current Timestamp
run: |
DATE=$(date '+%Y%m%d')
echo "date_ts=$DATE" >> $GITHUB_ENV
- id: create-pr
name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
path: "."
branch: "check-templates-${{ matrix.sdk }}-${{ env.date_ts }}"
token: "${{ secrets.FATTUREINCLOUD_BOT_TOKEN }}"
delete-branch: true
base: master
commit-message: "chore: updating templates for ${{ matrix.sdk }} sdk"
committer: fattureincloud-bot <info@fattureincloud.it>
title: "Checking templates for ${{ matrix.sdk }} SDK"
body: "Automatically checking modifies on custom templates for ${{ matrix.sdk }} SDK"