diff --git a/.github/workflows/terraform_plan.yaml b/.github/workflows/terraform_plan.yaml index 057c608..4a0b337 100644 --- a/.github/workflows/terraform_plan.yaml +++ b/.github/workflows/terraform_plan.yaml @@ -52,7 +52,7 @@ jobs: - name: Setup GITHUB Credentials id: github_credentials run: | - python encode_jwt.py "$GITHUB_APP_PEM_FILE" "$GITHUB_APP_INSTALLATION_ID" "$GITHUB_BASE_URL" #>> $GITHUB_ENV + export GITHUB_TOKEN=$(python encode_jwt.py "$GITHUB_APP_PEM_FILE" "$GITHUB_APP_INSTALLATION_ID" "$GITHUB_BASE_URL") - name: Terraform Init id: init diff --git a/encode_jwt.py b/encode_jwt.py index b2e7e51..a777670 100644 --- a/encode_jwt.py +++ b/encode_jwt.py @@ -23,9 +23,6 @@ parser.add_argument('enterprise_url', type=str, help='GitHub Enterprise API URL (e.g., https://github.e.it.census.gov)') args = parser.parse_args() -print(args.private_key) -print(args.installation_id) -print(args.enterprise_url) # Load the PEM private key private_key = load_pem_private_key(args.private_key.encode(), password=None) @@ -68,8 +65,6 @@ "Accept": "application/vnd.github+json" } -print(jwt_token) - # Make the request to the GitHub Enterprise API to get the installation access token url = f"{args.enterprise_url}api/v3/app/installations/{args.installation_id}/access_tokens" response = requests.post(url, headers=headers)