From 0ac8edcbe93824c9383ee0e53cae69e0b70cd316 Mon Sep 17 00:00:00 2001 From: Igor Rodionov <496956+goruha@users.noreply.github.com> Date: Thu, 8 Oct 2026 20:17:36 +0200 Subject: [PATCH 1/2] Refactor secrets management in Terraform workflow Removed REPO_ACCESS_TOKEN secret and updated secrets handling. --- .github/workflows/shared-terraform-scheduled.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/shared-terraform-scheduled.yml b/.github/workflows/shared-terraform-scheduled.yml index f1488e31..48dadded 100644 --- a/.github/workflows/shared-terraform-scheduled.yml +++ b/.github/workflows/shared-terraform-scheduled.yml @@ -8,10 +8,6 @@ on: type: string required: false default: '["ubuntu-latest"]' - secrets: - REPO_ACCESS_TOKEN: - description: "GitHub API token" - required: true concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -23,7 +19,7 @@ jobs: with: runs-on: ${{ inputs.runs-on }} secrets: - github_access_token: ${{ secrets.REPO_ACCESS_TOKEN }} + secrets: inherit readme: uses: cloudposse/.github/.github/workflows/shared-atmos-readme.yml@main From 3eea809b1e9f11324cb0efcc72df94587a896723 Mon Sep 17 00:00:00 2001 From: Igor Rodionov <496956+goruha@users.noreply.github.com> Date: Thu, 8 Oct 2026 20:25:01 +0200 Subject: [PATCH 2/2] Refactor GitHub Actions workflow for token usage Updated GitHub Actions workflow to use GitHub App token for authentication instead of a personal access token. Added environment setting for the job and modified the context.tf update process. --- .../workflows/shared-scheduled-context.yml | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/.github/workflows/shared-scheduled-context.yml b/.github/workflows/shared-scheduled-context.yml index e7cf9679..12c5957a 100644 --- a/.github/workflows/shared-scheduled-context.yml +++ b/.github/workflows/shared-scheduled-context.yml @@ -12,15 +12,18 @@ on: type: string required: false default: '["ubuntu-latest"]' - secrets: - github_access_token: - description: "GitHub API token" - required: true jobs: update: runs-on: ${{ fromJSON(inputs.runs-on) }} + environment: release steps: + - uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 + id: github-app + with: + app-id: ${{ vars.BOT_GITHUB_APP_ID }} + private-key: ${{ secrets.BOT_GITHUB_APP_PRIVATE_KEY }} + - name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -28,7 +31,7 @@ jobs: shell: bash id: update env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + GITHUB_TOKEN: "${{ steps.github-app.outputs.token }}" run: | if [[ -f context.tf ]]; then echo "Discovered existing context.tf! Fetching most recent version to see if there is an update." @@ -37,9 +40,10 @@ jobs: echo "No changes detected! Exiting the job..." else echo "context.tf file has changed. Update examples and rebuild README.md." - make init - make github/init/context.tf - make readme/build + if [[ -d examples/complete ]]; then + cp -p context.tf examples/complete/context.tf ; + fi; + find . -xdev -mindepth 2 -name context.tf -exec cp -p context.tf {}; echo "create_pull_request=true" >> $GITHUB_OUTPUT fi else @@ -65,6 +69,4 @@ jobs: labels: | auto-update context - # Requires a GitHub PAT used to open PRs that trigger other workflows - # https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow - token: ${{ secrets.github_access_token }} + token: ${{ steps.github-app.outputs.token }}