Generate PRs to client libraries repositories #7
Workflow file for this run
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: 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 |