diff --git a/action.yml b/action.yml index e18f2de..20ae5df 100644 --- a/action.yml +++ b/action.yml @@ -12,6 +12,16 @@ inputs: var-file: description: 'Path to a Terraform tfvars file' required: false + github_app_pem_file: + description: 'GitHub App PEM file for SSH-to-HTTPS git rewrite during terraform init' + required: false + github_app_installation_id: + description: 'GitHub App Installation ID for SSH-to-HTTPS git rewrite during terraform init' + required: false + github_app_id: + description: 'GitHub App ID for SSH-to-HTTPS git rewrite during terraform init' + required: false + default: '6' outputs: is_valid: @@ -30,11 +40,21 @@ outputs: runs: using: "composite" steps: - - name: Configure git HTTPS insteadOf SSH + - name: Setup GITHUB Credentials + id: github_credentials + if: ${{ inputs.github_app_pem_file != '' }} + uses: CSVD/gh-auth@main + with: + github_app_pem_file: ${{ inputs.github_app_pem_file }} + github_app_installation_id: ${{ inputs.github_app_installation_id }} + github_app_id: ${{ inputs.github_app_id }} + + - name: Configure Git HTTPS for Terraform module pulls + if: ${{ inputs.github_app_pem_file != '' }} shell: bash run: | - git config --global url."https://github.e.it.census.gov/".insteadOf "ssh://git@github.e.it.census.gov/" - git config --global url."https://github.e.it.census.gov/".insteadOf "git@github.e.it.census.gov:" + git config --global url."https://oauth2:${{ steps.github_credentials.outputs.github_token }}@github.e.it.census.gov/".insteadOf "git@github.e.it.census.gov:" + git config --global url."https://oauth2:${{ steps.github_credentials.outputs.github_token }}@github.e.it.census.gov/".insteadOf "ssh://git@github.e.it.census.gov/" - name: Terraform Init shell: bash