Skip to content

Commit 94e35e5

Browse files
milldrgithub-actions[bot]
authored andcommitted
(github actions) generated latest snippets
1 parent 7dc3212 commit 94e35e5

6 files changed

Lines changed: 111 additions & 203 deletions

File tree

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1-
name: 👽 Atmos Pro List instances
1+
name: "👽 Atmos Pro List instances"
22
run-name: list instances
33

44
on:
55
schedule:
66
- cron: '0 0 * * *'
77
workflow_dispatch:
88

9-
# Avoid running the same stack in parallel mode (from different workflows)
10-
# This applied to across workflows to both plan and apply
9+
# Avoid running the same workflow in parallel.
1110
concurrency:
1211
group: ${{ github.workflow }}
1312
cancel-in-progress: false
1413

1514
permissions:
16-
id-token: write # This is required for requesting the JWT
17-
contents: read # This is required for actions/checkout
15+
id-token: write # Required for requesting the JWT (OIDC) token
16+
contents: read # Required for actions/checkout
1817

1918
jobs:
2019
atmos-list-instances:
@@ -27,27 +26,20 @@ jobs:
2726
- "private=false"
2827

2928
steps:
30-
- uses: runs-on/action@v1
31-
- uses: unfor19/install-aws-cli-action@v1
29+
- uses: runs-on/action@v2
30+
31+
- name: Install Atmos
32+
uses: cloudposse/github-action-setup-atmos@v3
33+
with:
34+
install-wrapper: false
35+
atmos-version: ${{ vars.ATMOS_VERSION }}
3236

3337
- name: Checkout
3438
uses: actions/checkout@v6
3539
with:
3640
fetch-depth: 0
3741

38-
- name: Set atmos cli config path vars
39-
shell: bash
40-
run: |-
41-
echo "ATMOS_CLI_CONFIG_PATH=$(realpath ${{ vars.ATMOS_CONFIG_PATH }})" >> $GITHUB_ENV
42-
43-
- name: Install Atmos
44-
uses: cloudposse/github-action-setup-atmos@v2
45-
with:
46-
atmos-version: ${{ vars.ATMOS_VERSION }}
47-
token: ${{ github.token }}
48-
install-wrapper: false
49-
50-
# We need to assume AWS credentials to read the Terraform state
42+
# We need to assume AWS credentials to read the Terraform state.
5143
- name: Assume Planner Role
5244
uses: aws-actions/configure-aws-credentials@v6
5345
with:
@@ -57,9 +49,11 @@ jobs:
5749
mask-aws-account-id: "no"
5850

5951
- name: List instances and upload to Atmos Pro
52+
shell: bash
6053
env:
6154
ATMOS_PRO_WORKSPACE_ID: ${{ vars.ATMOS_PRO_WORKSPACE_ID }}
6255
ATMOS_PROFILE: "github-plan"
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6357
run: |
6458
atmos list instances \
6559
--upload
Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
name: 👽 Atmos Pro Terraform Apply
2-
run-name: apply ${{ inputs.component }}/${{ inputs.stack }}/${{ inputs.atmos_pro_run_id}}
1+
name: Atmos Pro Terraform Apply
2+
run-name: apply ${{ inputs.component }}/${{ inputs.stack }}/${{ inputs.atmos_pro_run_id }}
33

44
on:
55
workflow_dispatch:
@@ -23,22 +23,24 @@ on:
2323
required: true
2424
type: string
2525

26-
# Avoid running the same stack in parallel mode (from different workflows)
27-
# This applied to across workflows to both plan and apply
26+
# Avoid running the same stack in parallel mode (from different workflows).
27+
# This applies across workflows to both plan and apply.
2828
concurrency:
2929
group: "${{ inputs.stack }}-${{ inputs.component }}"
3030
cancel-in-progress: false
3131

3232
permissions:
33-
id-token: write # This is required for requesting the JWT
34-
contents: read # This is required for actions/checkout
33+
id-token: write # Required for requesting the JWT (OIDC) token
34+
contents: read # Required for actions/checkout
35+
checks: write # Required for CI commit status checks
36+
statuses: write # Required for CI commit status checks
3537

3638
jobs:
3739
atmos-apply:
3840
name: ${{ inputs.component }}-${{ inputs.stack }}
3941

4042
# The GitHub environment is defined in Atmos Pro settings.
41-
# Typically this is <tenant>-<stage>
43+
# Typically this is <tenant>-<stage>.
4244
environment: ${{ inputs.github_environment }}
4345

4446
runs-on:
@@ -48,18 +50,26 @@ jobs:
4850
- "private=true"
4951

5052
steps:
51-
- uses: runs-on/action@v1
52-
- uses: unfor19/install-aws-cli-action@v1
53+
- uses: runs-on/action@v2
5354

54-
- name: Apply Atmos Component
55-
uses: cloudposse/github-action-atmos-terraform-apply@v7
56-
env:
57-
ATMOS_PROFILE: "github-apply"
55+
- name: Checkout
56+
uses: actions/checkout@v6
57+
with:
58+
ref: ${{ inputs.sha }}
59+
60+
- name: Install Atmos
61+
uses: cloudposse/github-action-setup-atmos@v3
5862
with:
59-
# Atmos Pro args
60-
component: ${{ inputs.component }}
61-
stack: ${{ inputs.stack }}
62-
sha: ${{ inputs.sha }}
63-
# Atmos required configuration
63+
install-wrapper: false
6464
atmos-version: ${{ vars.ATMOS_VERSION }}
65-
atmos-config-path: ${{ vars.ATMOS_CONFIG_PATH }}
65+
66+
- name: Apply Atmos Component
67+
shell: bash
68+
env:
69+
ATMOS_PROFILE: github-apply
70+
ATMOS_PRO_WORKSPACE_ID: ${{ vars.ATMOS_PRO_WORKSPACE_ID }}
71+
ATMOS_PRO_RUN_ID: ${{ inputs.atmos_pro_run_id }}
72+
GITHUB_SHA: ${{ inputs.sha }}
73+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74+
run: |
75+
atmos terraform deploy ${{ inputs.component }} -s ${{ inputs.stack }} --upload-status
Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
name: 👽 Atmos Pro Terraform Plan
2-
run-name: plan ${{ inputs.component }}/${{ inputs.stack }}/${{ inputs.atmos_pro_run_id}}
1+
name: Atmos Pro Terraform Plan
2+
run-name: plan ${{ inputs.component }}/${{ inputs.stack }}/${{ inputs.atmos_pro_run_id }}
33

44
on:
55
workflow_dispatch:
@@ -18,21 +18,23 @@ on:
1818
description: "Stack"
1919
required: true
2020
type: string
21-
upload_status:
22-
description: "Upload status to Atmos Pro"
21+
upload:
22+
description: "Upload plan status to Atmos Pro"
23+
type: string
2324
required: false
24-
type: boolean
25-
default: false
25+
default: "false"
2626

27-
# Avoid running the same stack in parallel mode (from different workflows)
28-
# This applied to across workflows to both plan and apply
27+
# Avoid running the same stack in parallel mode (from different workflows).
28+
# This applies across workflows to both plan and apply.
2929
concurrency:
3030
group: "${{ inputs.stack }}-${{ inputs.component }}"
3131
cancel-in-progress: false
3232

3333
permissions:
34-
id-token: write # This is required for requesting the JWT (OIDC) token
35-
contents: read # This is required for actions/checkout
34+
id-token: write # Required for requesting the JWT (OIDC) token
35+
contents: read # Required for actions/checkout
36+
checks: write # Required for CI commit status checks
37+
statuses: write # Required for CI commit status checks
3638

3739
jobs:
3840
atmos-plan:
@@ -45,21 +47,26 @@ jobs:
4547
- "private=true"
4648

4749
steps:
48-
- uses: runs-on/action@v1
49-
- uses: unfor19/install-aws-cli-action@v1
50+
- uses: runs-on/action@v2
51+
52+
- name: Checkout
53+
uses: actions/checkout@v6
54+
with:
55+
ref: ${{ inputs.sha }}
56+
57+
- name: Install Atmos
58+
uses: cloudposse/github-action-setup-atmos@v3
59+
with:
60+
install-wrapper: false
61+
atmos-version: ${{ vars.ATMOS_VERSION }}
5062

5163
- name: Plan Atmos Component
52-
uses: cloudposse/github-action-atmos-terraform-plan@v5
64+
shell: bash
5365
env:
54-
ATMOS_PROFILE: "github-plan"
66+
ATMOS_PROFILE: github-plan
5567
ATMOS_PRO_WORKSPACE_ID: ${{ vars.ATMOS_PRO_WORKSPACE_ID }}
56-
with:
57-
# Atmos Pro args
58-
component: ${{ inputs.component }}
59-
stack: ${{ inputs.stack }}
60-
sha: ${{ inputs.sha }}
61-
# Upload the status to Atmos Pro
62-
atmos-pro-upload-status: ${{ inputs.upload_status }}
63-
# Atmos required configuration
64-
atmos-version: ${{ vars.ATMOS_VERSION }}
65-
atmos-config-path: ${{ vars.ATMOS_CONFIG_PATH }}
68+
ATMOS_PRO_RUN_ID: ${{ inputs.atmos_pro_run_id }}
69+
GITHUB_SHA: ${{ inputs.sha }}
70+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71+
run: |
72+
atmos terraform plan ${{ inputs.component }} -s ${{ inputs.stack }} --upload-status
Lines changed: 37 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
name: 👽 Atmos Pro Determine Affected Stacks
2-
run-name: 👽 Atmos Pro Determine Affected Stacks
1+
name: Atmos Pro
2+
run-name: Atmos Pro
33

44
# Atmos Pro reacts to events defined in the Atmos stack settings
55
# and will trigger the appropriate workflows for the given event.
66
#
77
# For example, pull requests opened, synchronize, and reopened will trigger plan workflows.
8-
# Whereas pull requests merged will trigger apply workflows
8+
# Whereas pull requests merged will trigger apply workflows.
99
on:
1010
pull_request:
1111
types:
@@ -17,14 +17,14 @@ on:
1717
- main
1818

1919
# Avoid conflicting workflow triggers.
20-
# For example, wait to trigger apply until plan has been triggered
20+
# For example, wait to trigger apply until plan has been triggered.
2121
concurrency:
2222
group: "${{ github.ref }}"
2323
cancel-in-progress: false
2424

2525
permissions:
26-
id-token: write # This is required for requesting the JWT (OIDC) token
27-
contents: read # This is required for actions/checkout
26+
id-token: write # Required for requesting the JWT (OIDC) token
27+
contents: read # Required for actions/checkout
2828

2929
jobs:
3030
affected:
@@ -36,39 +36,41 @@ jobs:
3636
- "tag=affected-stacks"
3737
- "private=false"
3838

39-
# Trigger Atmos Pro for Pull Request plan events and specifically closed PRs that have been merged (not just closed)
40-
# Skip if the PR has the "no-apply" label
39+
# Trigger for PR plan events and specifically closed PRs that have been merged (not just closed).
40+
# Skip if the PR has the "no-apply" label.
4141
if: |
4242
!contains(github.event.pull_request.labels.*.name, 'no-apply') &&
4343
(github.event.action != 'closed' || (github.event.action == 'closed' && github.event.pull_request.merged == true))
4444
4545
steps:
46-
- uses: runs-on/action@v1
46+
- uses: runs-on/action@v2
47+
48+
# Checkout the PR head SHA so the uploaded HeadSHA matches the webhook trigger event.
4749
- name: Checkout
48-
# For merged PRs, we will need to checkout the base branch to get the correct base branch SHA.
49-
# This isn't necessary for other events.
50-
if: github.event.action == 'closed'
5150
uses: actions/checkout@v6
5251
with:
53-
fetch-depth: 0 # Fetch all history for all branches and tags
52+
ref: ${{ github.event.pull_request.head.sha }}
53+
fetch-depth: 0
54+
55+
- name: Install Atmos
56+
uses: cloudposse/github-action-setup-atmos@v3
57+
with:
58+
install-wrapper: false
59+
atmos-version: ${{ vars.ATMOS_VERSION }}
5460

55-
# For merged PRs, we want to use 1 previous commit from the base branch SHA
56-
# This is because by the time this workflow runs, the PR branch has already been merged.
57-
# It's critical to use the base branch SHA to get the correct changes, not the previous commit from the PR branch.
58-
- name: Determine previous commit on base branch
59-
id: get_parent
60-
if: github.event.action == 'closed'
61+
# For merged PRs, use HEAD~1 to get the commit before the merge.
62+
# For open PRs, use the PR base SHA directly.
63+
- name: Determine base ref
64+
id: refs
6165
shell: bash
6266
run: |
63-
# For squash merges, github.event.pull_request.base.sha represents the state of the base branch
64-
# when the PR was created (or last updated). This may be stale compared to the actual commit
65-
# on the main branch at the time of the merge. Using 'HEAD~1' after the merge ensures we get
66-
# the commit that was the tip of main immediately before the squash merge commit was added.
67-
echo "Merge commit: $(git rev-parse HEAD)"
68-
PARENT=$(git rev-parse HEAD~1)
69-
echo "Parent (base) commit: $PARENT"
70-
echo "merge_commit=$MERGE_COMMIT" >> "$GITHUB_OUTPUT"
71-
echo "parent_commit=$PARENT" >> "$GITHUB_OUTPUT"
67+
if [[ "${{ github.event.action }}" == "closed" ]]; then
68+
PARENT=$(git rev-parse HEAD~1)
69+
echo "base_ref=$PARENT" >> "$GITHUB_OUTPUT"
70+
else
71+
echo "base_ref=${{ github.event.pull_request.base.sha }}" >> "$GITHUB_OUTPUT"
72+
fi
73+
echo "head_ref=${{ github.event.pull_request.head.sha }}" >> "$GITHUB_OUTPUT"
7274
7375
- name: Assume Planner Role
7476
uses: aws-actions/configure-aws-credentials@v6
@@ -79,16 +81,13 @@ jobs:
7981
mask-aws-account-id: "no"
8082

8183
- name: Determine Affected Stacks
82-
id: affected
83-
uses: cloudposse/github-action-atmos-affected-stacks@v6
84+
shell: bash
8485
env:
8586
ATMOS_PRO_WORKSPACE_ID: ${{ vars.ATMOS_PRO_WORKSPACE_ID }}
8687
ATMOS_PROFILE: "github-plan"
87-
with:
88-
atmos-version: ${{ vars.ATMOS_VERSION }}
89-
atmos-config-path: ${{ vars.ATMOS_CONFIG_PATH }}
90-
atmos-pro-upload: true
91-
# Compare the head of the PR to the base of the PR if the PR is not merged.
92-
# If the PR is merged, compare the head of the PR to 1 previous commit on the base branch.
93-
head-ref: ${{ github.event.pull_request.head.sha }}
94-
base-ref: ${{ github.event.action == 'closed' && steps.get_parent.outputs.parent_commit || github.event.pull_request.base.sha }}
88+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89+
run: |
90+
atmos describe affected \
91+
--ref ${{ steps.refs.outputs.head_ref }} \
92+
--sha ${{ steps.refs.outputs.base_ref }} \
93+
--upload

0 commit comments

Comments
 (0)