Check Custom Templates #63
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |