Skip to content

Commit

Permalink
fixing (#3)
Browse files Browse the repository at this point in the history
* adding insteadOf

* fix: use --add to preserve both insteadOf rules

* feat: add gh-auth token-authenticated HTTPS insteadOf for terraform init SSH module pulls

- Add github_app_pem_file, github_app_installation_id, github_app_id inputs
- Add CSVD/gh-auth@main step to generate token (conditional on pem_file input)
- Replace unauthenticated broken insteadOf with oauth2-token authenticated HTTPS rewrites
- Mirrors pattern from CSVD/terraform-init action
- Resolves CSVDIES-10490

---------

Co-authored-by: Dave Arnold <user@example.com>
  • Loading branch information
arnol377 and Dave Arnold committed Jul 23, 2026
1 parent d0980d1 commit 77747a7
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down

0 comments on commit 77747a7

Please sign in to comment.