Skip to content

fix: add SSH-to-HTTPS git insteadOf config for terraform module pulls (CSVDIES-10219) #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ inputs:
default: false
init_args:
required: false
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
cache_bucket:
Expand Down Expand Up @@ -72,6 +82,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.backend_config != '' }}
Expand Down