diff --git a/action.yml b/action.yml index 780b21c..8a8ca89 100644 --- a/action.yml +++ b/action.yml @@ -34,6 +34,16 @@ inputs: init_args: required: false description: "Terraform Init Args" + github_app_pem_file: + required: false + description: "GitHub App PEM file for SSH-to-HTTPS git rewrite during terraform init" + github_app_installation_id: + required: false + description: "GitHub App Installation ID for SSH-to-HTTPS git rewrite during terraform init" + github_app_id: + required: false + default: "6" + description: "GitHub App ID for SSH-to-HTTPS git rewrite during terraform init" commit_sha: required: false default: "" @@ -89,6 +99,22 @@ runs: run: | echo "TF_WORKSPACE=${{ inputs.workspace }}" >> $GITHUB_ENV + - 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://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 id: init_state if: ${{ inputs.terraform_init == 'true' && inputs.state_bucket != '' }}