Skip to content

Commit acbb7b1

Browse files
authored
Merge pull request #7 from cloudposse/added-github-workflows
Added workflows
2 parents 63ad787 + 01d3fe5 commit acbb7b1

26 files changed

+2422
-37
lines changed

.github/workflows/feature-branch.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Feature branch
2+
on:
3+
pull_request:
4+
branches: [ main ]
5+
types: [opened, synchronize, reopened]
6+
7+
jobs:
8+
perform:
9+
uses: cloudposse/github-actions-workflows-github-action-composite/.github/workflows/feature-branch.yml@main
10+
with:
11+
organization: "${{ github.event.repository.owner.login }}"
12+
repository: "${{ github.event.repository.name }}"
13+
ref: "${{ github.event.pull_request.head.ref }}"
14+
secrets:
15+
github-private-actions-pat: "${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}"

.github/workflows/main-branch.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Main branch
2+
on:
3+
push:
4+
branches: [ main ]
5+
6+
permissions:
7+
contents: write
8+
9+
jobs:
10+
perform:
11+
uses: cloudposse/github-actions-workflows-github-action-composite/.github/workflows/main-branch.yml@main
12+
with:
13+
organization: "${{ github.event.repository.owner.login }}"
14+
repository: "${{ github.event.repository.name }}"
15+
secrets:
16+
github-private-actions-pat: "${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}"
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: "Test - Changes exist - Drift"
2+
3+
on:
4+
workflow_dispatch: {}
5+
6+
env:
7+
AWS_REGION: us-east-2
8+
9+
# Permissions required for assuming AWS identity
10+
permissions:
11+
id-token: write
12+
contents: read
13+
issues: write
14+
15+
jobs:
16+
setup:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Setup
20+
run: echo "Do setup"
21+
22+
- uses: actions/checkout@v4
23+
with:
24+
ref: ${{ github.event.pull_request.head.ref }}
25+
26+
- name: Upload Artifacts
27+
uses: actions/upload-artifact@v3
28+
with:
29+
name: metadata
30+
path: ./tests/fixtures/metadata
31+
retention-days: 1
32+
33+
test:
34+
runs-on: ubuntu-latest
35+
continue-on-error: true
36+
needs: [setup]
37+
steps:
38+
- uses: actions/checkout@v4
39+
with:
40+
ref: ${{ github.event.pull_request.head.ref }}
41+
42+
- name: Plan Atmos Component
43+
id: current
44+
uses: ./
45+
with:
46+
max-opened-issues: '4'
47+
labels: "test-changes-exists"
48+
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
49+
50+
outputs:
51+
result: ${{ steps.current.outcome }}
52+
53+
assert:
54+
runs-on: ubuntu-latest
55+
needs: [test]
56+
steps:
57+
- uses: nick-fields/assert-action@v1
58+
with:
59+
expected: 'success'
60+
actual: "${{ needs.test.outputs.result }}"
61+
62+
- name: Find all issues
63+
id: issues
64+
uses: lee-dohm/select-matching-issues@v1
65+
with:
66+
query: 'label:drift label:test-changes-exists is:open'
67+
token: ${{ github.token }}
68+
69+
- name: Close found issues
70+
id: test
71+
run: |
72+
echo "count=$(cat ${{ steps.issues.outputs.path }} | xargs -I {} -d '\n' echo "{}" | wc -l )" >> $GITHUB_OUTPUT
73+
74+
- uses: nick-fields/assert-action@v1
75+
with:
76+
expected: '4'
77+
actual: "${{ steps.test.outputs.count }}"
78+
79+
teardown:
80+
runs-on: ubuntu-latest
81+
needs: [assert]
82+
if: ${{ always() }}
83+
steps:
84+
- name: Tear down
85+
run: echo "Do Tear down"
86+
87+
- name: Find all issues
88+
id: issues
89+
uses: lee-dohm/select-matching-issues@v1
90+
with:
91+
query: 'label:drift label:test-changes-exists is:open'
92+
token: ${{ github.token }}
93+
94+
- name: Close found issues
95+
run: cat ${{ steps.issues.outputs.path }} | xargs -I {} -d '\n' gh issue close {}
96+
env:
97+
GH_TOKEN: ${{ github.token }}

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ inputs:
1717
description: "Comma-separated list of teams to assign issues to. You have to pass github token with `read:org` scope. This is used only when issue is getting created."
1818
required: false
1919
default: ""
20+
labels:
21+
description: "Comma-separated list of additional labels to assign issues to."
22+
required: false
23+
default: ""
2024
token:
2125
description:
2226
Used to pull node distributions for Atmos from Cloud Posse's GitHub repository. Since there's a default, this is typically

0 commit comments

Comments
 (0)