From 4814af082ba2184b8b0cacb8587a3f1c9142a47b Mon Sep 17 00:00:00 2001 From: Cameron Koegel <53310569+ckoegel@users.noreply.github.com> Date: Fri, 8 Nov 2024 11:19:43 -0500 Subject: [PATCH] SWI-6181 Update Action (#40) * SWI-6181 Update Action * add additional-properties input * update readme --- .github/workflows/test.yml | 17 ------------ README.md | 34 +++++++---------------- action.yml | 55 +++++++------------------------------- 3 files changed, 18 insertions(+), 88 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index de15df96..8dca2942 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,30 +9,13 @@ jobs: test: name: Test runs-on: ${{ fromJSON(vars.SWI_GLORG_UBUNTU_2204) }} - permissions: - id-token: write - contents: write steps: - - name: Get Github Token from Vault - uses: Bandwidth/vault-provider-action@v1 - with: - export-github-pat: true - - name: Checkout uses: actions/checkout@v4 - name: Run Test with Local Files - id: generate uses: ./ with: - branch-name: ci-cd-test - token: ${{ env.GITHUB_TEAM_ACCESS_TOKEN }} - openapi-generator-version: 6.5.0 language: python api-spec-path: ./utils/bandwidth.yml config: ./utils/test-config.yml - - - name: Delete Branch - if: ${{ always() }} - run: git push origin --delete ci-cd-test - shell: bash diff --git a/README.md b/README.md index 3e1ebdab..8c4a1e48 100644 --- a/README.md +++ b/README.md @@ -5,43 +5,27 @@ This action utilizes the [openapi-generator-cli](https://github.com/OpenAPITools ## Inputs ```yml -branch-name: - description: Branch name - required: true -token: - description: Github auth token - required: true language: description: The generator name (language) (`-g`) argument for the openapi-generator-cli required: true config: description: The configuration (`-c`) argument for the openapi-generator-cli - required: true -user-email: - description: Git user email - default: dx@bandwidth.com required: false -username: - description: Github username - default: DX-Bandwidth + default: ./openapi-config.yml +api-spec-path: + description: The destination of the API Specification to generate a client from required: false + default: ./bandwidth.yml openapi-generator-version: description: The OpenAPI Generator project version, in `x.x.x` format required: false - default: '6.5.0' -api-spec-path: - description: The destination of the API Specification to generate a client from + default: '7.6.0' +additional-properties: + description: Additional properties to pass to the generator required: false - default: ./bandwidth.yml -working-directory: + default: '' +working-directory: description: The working directory to run the action in required: false default: ./ ``` - -## Outputs - -```yml -changes: - description: Boolean representing if files in the SDK were changed or not. -``` diff --git a/action.yml b/action.yml index 17bdb56c..07e1f562 100644 --- a/action.yml +++ b/action.yml @@ -1,44 +1,30 @@ name: Generate SDK Action description: Generate an SDK using the OpenAPI Generator Project inputs: - branch-name: - description: Branch name - required: true - token: - description: Github auth token - required: true language: description: The generator name (language) (`-g`) argument for the openapi-generator-cli required: true config: description: The configuration (`-c`) argument for the openapi-generator-cli - required: true - user-email: - description: Git user email - default: dx@bandwidth.com required: false - username: - description: Github username - default: DX-Bandwidth + default: ./openapi-config.yml + api-spec-path: + description: The destination of the API Specification to generate a client from required: false + default: ./bandwidth.yml openapi-generator-version: description: The OpenAPI Generator project version, in `x.x.x` format required: false - default: '6.5.0' - api-spec-path: - description: The destination of the API Specification to generate a client from + default: '7.6.0' + additional-properties: + description: Additional properties to pass to the generator required: false - default: ./bandwidth.yml + default: '' working-directory: description: The working directory to run the action in required: false default: ./ -outputs: - changes: - description: Boolean representing if files in the SDK were changed or not. - value: ${{ steps.commit.outputs.changes }} - runs: using: composite steps: @@ -47,14 +33,6 @@ runs: with: node-version: 20 - - name: Configure Git and Create Branch - run: | - git config user.email ${{ inputs.user-email }} - git config user.name ${{ inputs.username }} - git checkout -b ${{ inputs.branch-name }} - shell: bash - working-directory: ${{ inputs.working-directory }} - - name: Setup OpenAPI Generator CLI run: | npm install @openapitools/openapi-generator-cli -g @@ -68,22 +46,7 @@ runs: -g ${{ inputs.language }} \ -i ${{ inputs.api-spec-path }} \ -c ${{ inputs.config }} \ + ${{ inputs.additional-properties }} \ -o ./ shell: bash working-directory: ${{ inputs.working-directory }} - - - name: Commit if Necessary - id: commit - run: | - if git diff --quiet; then - echo "No Changes" - else - git add . - git commit -m "Generate SDK with OpenAPI Generator Version ${{ inputs.openapi-generator-version }}" - git push origin ${{ inputs.branch-name }} - echo "changes=true" >> $GITHUB_OUTPUT - fi - env: - GITHUB_TOKEN: ${{ inputs.token }} - shell: bash - working-directory: ${{ inputs.working-directory }}