Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upstream merge #13

Open
wants to merge 290 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
290 commits
Select commit Hold shift + click to select a range
578788e
:bookmark: v.1.8.0
dflook Apr 5, 2021
16b1370
Fix example workflow errors in triggers
vemel Apr 7, 2021
2a43cb2
Merge pull request #50 from vemel/example-workflow
dflook Apr 7, 2021
faabccc
Fix example lint.yaml
dflook Apr 7, 2021
631fe45
Add variables input and deprecate vars
dflook Apr 10, 2021
e16534c
Merge pull request #51 from dflook/vars
dflook Apr 10, 2021
13bc2fa
:bookmark: v1.9.0
dflook Apr 10, 2021
dbe33a8
:pencil: Fix typo
dflook Apr 10, 2021
2aa0dc6
Add job runs badge
dflook Apr 14, 2021
91c7118
Update test for terraform 0.15.0 release
dflook Apr 14, 2021
20000bc
Merge pull request #52 from dflook/15
dflook Apr 14, 2021
df075fc
Fix missing quotes in examples
dflook Apr 19, 2021
d4aaaf5
Add warning about unmasked variables
dflook Apr 19, 2021
7219a09
Fix extracting terraform 0.15 plan
dflook Apr 21, 2021
fbe74cb
Merge pull request #55 from dflook/plan-15
dflook Apr 21, 2021
46179c7
:bookmark: v1.9.1
dflook Apr 21, 2021
a51f395
Don't include state lock status in plan
dflook May 5, 2021
efae9ac
Merge pull request #63 from dflook/fix-lock-plan-diff
dflook May 5, 2021
13df1d1
:bookmark: v1.9.1
dflook May 5, 2021
51d488a
:bookmark: v1.9.2
dflook May 5, 2021
adb1eeb
Update base image every week
dflook May 5, 2021
80da91d
Fix typo
styx May 6, 2021
54fca1a
allow shell commands to be executed before terraform is ran
May 12, 2021
d6fee96
missed one
May 12, 2021
72fe884
test new 'run' parameter
May 12, 2021
6fb18ea
testing
May 12, 2021
3ff4fd1
remove testing
May 12, 2021
5fd423f
woops, corrected operator and also execute command with `eval`
May 12, 2021
230d582
remove un-needed parameter from remote state and new-workspace actions
May 17, 2021
ded64cb
add option to use `TERRAFORM_PRE_RUN` env variable
May 17, 2021
4fa4ed4
add `TERRAFORM_PRE_RUN` to docs
May 17, 2021
539bfa7
Fix 0.15.4 plan with only changes to outputs
dflook May 29, 2021
052c63c
:bookmark: v1.9.3
dflook May 29, 2021
7c5307e
Merge pull request #69 from dflook/tf-0_15_4
dflook May 29, 2021
f4b426c
:bookmark: v1.9.3
dflook May 29, 2021
ec5d6f6
Add TERRAFORM_HTTP_CREDENTIALS
dflook May 29, 2021
031cd60
Merge pull request #70 from dflook/http-credentials
dflook May 30, 2021
29f8b23
:bookmark: v1.10.0
dflook May 30, 2021
1f4073a
changes-only
dflook May 30, 2021
c42fabc
Improve changed plan messaging
dflook Jun 4, 2021
8607b03
Update docs to use newlines instead of commas
dflook Jun 4, 2021
ccfcded
Update changelog
dflook Jun 4, 2021
4e7e6ec
Merge pull request #72 from dflook/changes-only
dflook Jun 4, 2021
8734bf6
:bookmark: v1.11.0
dflook Jun 4, 2021
045db96
Update CHANGELOG.md
dflook Jun 4, 2021
f2a4136
Be more resilient to github failures
dflook Jun 5, 2021
cebad39
Fix release
dflook Jun 5, 2021
a12e716
Fix release
dflook Jun 5, 2021
d3a097b
Use docker digest in released metadata
dflook Jun 5, 2021
37f1267
Update CHANGELOG.md
dflook Jun 5, 2021
ddb7bf5
Fix example syntax error
dflook Jun 5, 2021
b56ea6e
Show fmt-check diff in workflow log
dflook Jun 6, 2021
41e9dba
Remove redundant exit code stuff
dflook Jun 6, 2021
dc6f1b0
Merge pull request #74 from dflook/fmt-diff
dflook Jun 6, 2021
a69b277
Show fmt diff in workflow log
dflook Jun 8, 2021
e4248e7
Update version test for terraform 1.0
dflook Jun 8, 2021
0205ee7
Show error if workspace fails to create
dflook Jun 8, 2021
0c3fc25
Merge pull request #77 from dflook/tf_1
dflook Jun 8, 2021
fbb0fa5
fixed implementation of terraform pre-run
GiuseppeChiesa-TomTom Jul 22, 2021
1debe8f
Merge branch 'master' into pre-run
GiuseppeChiesa-TomTom Jul 22, 2021
5aacad5
updated test plan
GiuseppeChiesa-TomTom Jul 22, 2021
545207e
Update terraform-destroy-workspace/action.yaml
GiuseppeChiesa-TomTom Jul 23, 2021
f84e27a
Update terraform-plan/README.md
GiuseppeChiesa-TomTom Jul 23, 2021
0cb74f8
updated documentation
GiuseppeChiesa-TomTom Jul 23, 2021
09ee469
Merge pull request #80 from GiuseppeChiesa-TomTom/pre-run
dflook Jul 24, 2021
ec54c6d
Add label to pre-run test comments
dflook Jul 24, 2021
b21bd92
Add label to pre-run test comments
dflook Jul 24, 2021
512ac83
Merge pull request #82 from dflook/pre-run-label
dflook Jul 24, 2021
f2de544
Execute pre-run commands with -eo pipefail
dflook Jul 24, 2021
a8b7f13
Merge pull request #83 from dflook/pre-run-e
dflook Jul 24, 2021
283f2ac
:bookmark: v1.13.0
dflook Jul 24, 2021
4635503
Mention contributers
dflook Jul 24, 2021
4522f53
Remove misplaced example
dflook Jul 25, 2021
596cf4c
Disable workflow commands where possible while grouping logs
dflook Jul 25, 2021
a68f20b
Disable workflow commands unless needed
dflook Jul 25, 2021
f62f92a
ACTIONS_STEP_DEBUG may have any value
dflook Jul 25, 2021
fa313e1
ACTIONS_STEP_DEBUG is not available unless explicitly passed in
dflook Jul 25, 2021
77dff02
Increase length of workflow command token
dflook Jul 25, 2021
6d65256
:point_right:
dflook Jul 26, 2021
85e508e
Refactor debug logging
dflook Jul 26, 2021
2d83ab2
Fix debug_file
dflook Jul 26, 2021
3293e90
Only stop workflow commands for pre-run
dflook Jul 26, 2021
190ba9c
Dont use Environment group
dflook Jul 26, 2021
2fa7607
.
dflook Jul 27, 2021
b5eb548
echo
dflook Jul 27, 2021
77240d7
Don't use a group for select-workspace
dflook Jul 28, 2021
2041b17
Don't use a group for select-workspace
dflook Jul 29, 2021
1cfa35b
Removed tfswitch tarball to decrease base image size slightly
Aug 11, 2021
df9d383
Fix typo in README
sjmiller609 Aug 18, 2021
142dfd9
Merge pull request #87 from sjmiller609/patch-1
dflook Aug 18, 2021
ed9725b
Merge pull request #65 from styx/patch-1
dflook Aug 18, 2021
8a35750
Support any github instance
Sep 13, 2021
d360c61
Merge pull request #91 from f0rkz/master
dflook Sep 15, 2021
2ebdb7a
Merge pull request #93 from dflook/remove_tfswitch_tarball
dflook Sep 15, 2021
23e3498
Merge pull request #94 from dflook/workflow-commands
dflook Sep 15, 2021
38a17a0
Use the action workspace by default
dflook Sep 15, 2021
5409929
Search comments over multiple api pages
dflook Sep 15, 2021
3b96e0c
Merge pull request #95 from dflook/optional-path
dflook Sep 15, 2021
8e20e61
:bookmark: v1.14.0
dflook Sep 15, 2021
455b995
Retain images
dflook Sep 18, 2021
4a0228b
Add failure-reason to terraform-validate
dflook Sep 18, 2021
934b1f4
Add failure-reason to fmt-check
dflook Sep 19, 2021
feed5e3
Add failure-reason to terraform-check
dflook Sep 19, 2021
8947f43
Add apply-failed failure-reason for terraform-apply
dflook Sep 19, 2021
2203979
Add plan-changed failure-reason for terraform-apply
dflook Sep 19, 2021
f39b4ee
Add destroy-failed failure-reason to terraform-destroy & terraform-de…
dflook Sep 19, 2021
4a7a263
Add failure-reason to changelog
dflook Sep 20, 2021
69b4ee3
Merge pull request #96 from dflook/failure-reason
dflook Sep 20, 2021
5f0956b
Update base image to bullseye
dflook Sep 20, 2021
65d0fcf
Reword
dflook Sep 20, 2021
2e109c2
:bookmark: v1.15.0
dflook Sep 20, 2021
04afb34
:books: Add docs for GITHUB_TOKEN permissions
dflook Sep 20, 2021
4a0c143
:books: Update base image to bullseye
dflook Sep 20, 2021
0fdaa41
Prefer the json output from terraform version
dflook Sep 25, 2021
78d27cc
Prefer the json output from terraform version
dflook Sep 25, 2021
2bb3cef
Prefer the json output from terraform version
dflook Sep 27, 2021
e02641d
Remove -no-color for version
dflook Sep 28, 2021
2495eb5
Merge pull request #99 from dflook/version-json
dflook Sep 28, 2021
71d74c7
Add json_plan_path output
dflook Oct 2, 2021
0475c23
Merge pull request #101 from dflook/plan-output
dflook Oct 4, 2021
18e881a
Add output doc for text_plan_path
dflook Oct 4, 2021
474faad
Remove test
dflook Oct 4, 2021
a9cf2c5
:bookmark: v1.16.0
dflook Oct 4, 2021
fdbde0f
Add 1.16.0 changes link
dflook Oct 4, 2021
11ddada
Add variables and var_files support for remote operations
dflook Oct 4, 2021
e0300f8
fixup
dflook Oct 4, 2021
65b027c
Add variables and var_files support for remote operations in terrafor…
dflook Oct 4, 2021
655b5ed
Merge pull request #103 from dflook/tfc-variables
dflook Oct 4, 2021
6c25198
:bookmark: v1.17.0
dflook Oct 4, 2021
2eea59c
Fix ownership of any files that are created in HOME or GITHUB_WORKSPACE
dflook Oct 5, 2021
b964eb4
Merge pull request #106 from dflook/fixup-workspace-permissions
dflook Oct 6, 2021
1b9f8ca
:bookmark: 1.17.1
dflook Oct 6, 2021
8c91971
Add plan output to workflow log
dflook Oct 13, 2021
f1fcd7a
Merge pull request #109 from dflook/plan_output
dflook Oct 13, 2021
dbe625d
:bookmark: 1.17.2
dflook Oct 13, 2021
455d0fd
Refactor github_pr_comment.py
dflook Oct 24, 2021
2ea412e
Cache PR comment info
dflook Oct 25, 2021
03739d0
Merge pull request #115 from dflook/pr_comment_cache
dflook Oct 25, 2021
4d25c42
Add tests for 1.0.10 workspace changes
dflook Oct 28, 2021
9ac3689
Update Terraform "workspace does not exist" regex
kylewlacy Oct 28, 2021
d09edbf
Merge pull request #118 from dflook/tf_1_0_10
dflook Oct 28, 2021
86a7aa5
:bookmark: v1.17.3
dflook Oct 28, 2021
e78ad9c
:pencil: Reword
dflook Oct 29, 2021
20cde72
Add target to plan, add replace to plan & apply
dflook Oct 18, 2021
99e73ee
Use plan args for remote applies
dflook Oct 28, 2021
93f7a74
Add remote targeting tests
dflook Oct 29, 2021
663d07d
Support variables in remote destroy operations
dflook Oct 29, 2021
9455c36
Send captured errors to stderr
dflook Oct 29, 2021
ab4a5b3
shellcheck
dflook Oct 30, 2021
ef4759b
shfmt
dflook Oct 30, 2021
e950b54
Merge pull request #111 from dflook/replace
dflook Oct 30, 2021
ba4c541
:pencil: tweak docs
dflook Oct 30, 2021
71821fa
:bookmark: v1.18.0
dflook Oct 30, 2021
03d7093
Add missing deprecation message
dflook Oct 30, 2021
505cffe
Add emojis to status updates
dflook Oct 30, 2021
101ceb9
Merge pull request #120 from dflook/tasteful-emoji
dflook Oct 31, 2021
0792c3f
Don't hold a state lock during the plan action
dflook Oct 31, 2021
a9aac78
Don't hold a state lock during the check action
dflook Oct 31, 2021
ca67656
Merge pull request #121 from dflook/plan-lock-false
dflook Nov 1, 2021
fcaa2f4
:bookmark: v1.19.0
dflook Nov 1, 2021
c56e996
Remove test-react
dflook Nov 1, 2021
2f1b3e9
Add issue templates
dflook Nov 27, 2021
940a176
Add labels as code
dflook Nov 27, 2021
3404f39
Fix colours
dflook Nov 27, 2021
066c1c3
Add `json_plan_path` and `text_plan_path` for dflook/terraform-apply
dflook Dec 3, 2021
9d41ad3
Merge pull request #138 from dflook/apply-plan-outputs
dflook Dec 3, 2021
01ee72f
:bookmark: v1.20.0
dflook Dec 3, 2021
a39c99c
Add test for terraform-output on remote workspaces
dflook Dec 4, 2021
972bb4c
Add test for terraform-output on remote workspaces with fixed name
dflook Dec 4, 2021
5dac838
Support remote backends using the full workspace name in the configur…
dflook Dec 4, 2021
33db26f
Support remote backends using the full workspace name in the configur…
dflook Dec 4, 2021
c8d5fd5
Merge pull request #139 from dflook/remote-output
dflook Dec 4, 2021
2305d4f
:bookmark: v1.20.1
dflook Dec 4, 2021
f54173c
Add workspace input for terraform-validate
dflook Dec 4, 2021
7c27822
Merge pull request #140 from dflook/workspace-eval
dflook Dec 4, 2021
83b8fe9
:bookmark: v1.21.0
dflook Dec 4, 2021
f70a557
Lint yaml
dflook Dec 6, 2021
ffeb5ff
Fix invalid action metadata
dflook Dec 6, 2021
6fe1131
Merge pull request #141 from dflook/lint2
dflook Dec 9, 2021
e1acdc8
Don't try to select workspace during init
dflook Dec 9, 2021
f4ea6bb
Merge pull request #142 from dflook/tf-1-1
dflook Dec 12, 2021
ac95418
:bookmark: v1.21.1
dflook Dec 12, 2021
2f894ab
Expand tf version detection
dflook Dec 17, 2021
ab85478
Update action inputs for InitArgs
dflook Jan 22, 2022
a5fe070
Use latest base image
dflook Jan 23, 2022
0faa852
Merge pull request #154 from dflook/terraform-version
dflook Jan 23, 2022
3cd78ec
Add labels to the base image
dflook Jan 23, 2022
eb3aa63
Merge pull request #155 from dflook/base-labels
dflook Jan 23, 2022
47172dc
Remove bad space
dflook Jan 23, 2022
44ef0cd
Correctly log base image digest
dflook Jan 23, 2022
418d2ae
Correctly log base image digest
dflook Jan 23, 2022
9b8fff4
Add the base image digest to the release image
dflook Jan 23, 2022
8599093
Merge pull request #156 from dflook/add-base-digest-to-image
dflook Jan 23, 2022
5630572
:bookmark: v1.22.0
dflook Jan 23, 2022
f6b6482
:books: Expand initialism
dflook Jan 23, 2022
6282232
Don't error if debug file doesn't exist
dflook Jan 23, 2022
1aa2b80
Fallback to environment variables for pr url if event payload not ava…
dflook Jan 24, 2022
bd58f5a
Merge pull request #157 from dflook/github-event-path
dflook Jan 24, 2022
75b306c
:bookmark: 1.22.1
dflook Jan 24, 2022
2766d46
Remove circular deprecation warning
dgrenner Feb 17, 2022
2ca878f
Merge pull request #163 from dgrenner/patch-1
dflook Feb 28, 2022
e7b3ff5
Fix compacting plans with only changes to outputs in >=0.15.4
dflook Feb 28, 2022
3190746
Merge pull request #167 from dflook/fix_compact_plan_15_4
dflook Feb 28, 2022
eaf38cf
:bookmark: v1.22.2
dflook Feb 28, 2022
1842b14
:pencil: Fix typo
dflook Mar 2, 2022
fc6c9b6
Refactor github_pr_comment
dflook Feb 16, 2022
47a58e5
Restore comment step cache
dflook Mar 4, 2022
4d4b5f4
Restore comment step cache
dflook Mar 5, 2022
28b6681
Don't use comments with headers as backup candidates
dflook Mar 5, 2022
a86fa1d
Add backend fingerprint comment header
dflook Mar 18, 2022
75c1c2d
Add canonicaljson
dflook Mar 18, 2022
fbcdb83
Typecheck
dflook Mar 18, 2022
6867f53
bytes
dflook Mar 18, 2022
35e091e
Include plan modifiers in headers
dflook Mar 18, 2022
380f135
Isolate test module per workflow
dflook May 1, 2022
b50436b
Fix header value bugs
dflook May 1, 2022
4e1ee35
Don't select prerelease versions when using latest terraform
dflook May 1, 2022
c2d3037
Fix paths
dflook May 1, 2022
fda43c4
Use job name in label
dflook May 1, 2022
037fa18
Don't match comments with a label if no label
dflook May 1, 2022
a32bf19
Don't match comments with a label if no label
dflook May 2, 2022
68fa447
Insert known headers into legacy comment
dflook May 2, 2022
1857bf9
Don't print status update errors to workflow log
dflook May 2, 2022
e07e62f
Merge pull request #179 from dflook/github_pr_comment_refactor
dflook May 2, 2022
153549e
refactor: diff key to help debug
toast-gear Apr 22, 2022
efb21fe
Fix path to ssh test module
dflook May 2, 2022
81c1dce
Fix path to http test module
dflook May 2, 2022
80692d2
Merge pull request #181 from dflook/diff
dflook May 2, 2022
99535ae
Use correct value for terraform.workspace when validating with remote…
dflook Feb 15, 2022
f973c80
Add test for remote workspace name validation
dflook May 2, 2022
5a5a2ac
Fix path
dflook May 2, 2022
62ade84
Merge pull request #182 from dflook/remote-workspace-validate
dflook May 2, 2022
f87a90c
Try loading hcl files in another process
dflook May 2, 2022
b0d2672
Try loading hcl files in another process
dflook May 2, 2022
1c31712
Merge pull request #184 from dflook/test-load
dflook May 2, 2022
9683a53
:bookmark: v1.23.0
dflook May 2, 2022
0f1203a
:pencil: typo
dflook May 2, 2022
f8a7b4f
Output the number if resources that would be changed by the plan
dflook May 3, 2022
f0500d7
Merge pull request #185 from dflook/plan-summary-outputs
dflook May 3, 2022
22daf28
:bookmark: v1.24.0
dflook May 3, 2022
4bc7e8d
Rename default branch
dflook May 4, 2022
bf57145
set json_plan_path with remote execution
dflook May 6, 2022
5eae880
Merge pull request #186 from dflook/cloud-json-plan
dflook May 6, 2022
9b444de
:bookmark: v1.25.0
dflook May 6, 2022
fa9a9f1
Fix version regex not matching version links
kylewlacy May 9, 2022
3a263fe
Test terraform version scraping
dflook May 10, 2022
475f146
Merge branch 'patch-2' of github.com:kylewlacy/terraform-github-actio…
dflook May 10, 2022
3c23d13
Merge pull request #189 from dflook/versions
dflook May 10, 2022
3972b2e
:bookmark: v1.25.1
dflook May 10, 2022
144da9d
Merge remote-tracking branch 'upstream/main' into upstream_merge
JohnPeacockMessageSystems May 11, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github:
- dflook
4 changes: 4 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
contact_links:
- name: Question
url: https://github.com/dflook/terraform-github-actions/discussions
about: Please ask questions as a new discussion if others would benefit from seeing the answer
44 changes: 44 additions & 0 deletions .github/ISSUE_TEMPLATE/problem.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Problem
description: I'm having a problem using these actions
labels:
- problem
body:
- type: markdown
attributes:
value: |
Before creating an issue, enable debug logging by setting the `ACTIONS_STEP_DEBUG` secret to `true` and run the job again.
- type: textarea
id: description
attributes:
description: What is not working? What do you think should be happening instead?
label: Problem description
validations:
required: true

- type: input
id: terraform-version
attributes:
label: Terraform version
description: What terraform version are you using?
placeholder: 1.0.5

- type: input
id: backend
attributes:
label: Backend
description: What terraform backend are you using?
placeholder: s3

- type: textarea
id: workflow
attributes:
label: Workflow YAML
description: Please copy and paste the relevant workflow yaml. This will be automatically formatted, so no need for backticks.
render: yaml

- type: textarea
id: workflow-logs
attributes:
label: Workflow log
description: Please copy and paste the relevant workflow log output. If this is long consider putting in a [gist](https://gist.github.com/). This will be automatically formatted, so no need for backticks.
render: shell
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/suggestion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Suggestion
description: I have a suggestion for an enhancement
labels:
- enhancement
body:
- type: textarea
id: suggestion
attributes:
label: Suggestion
validations:
required: true
1 change: 1 addition & 0 deletions .github/github_sucks.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Everytime I need to generate a push or synchronise event I will touch this file.
This is usually because GitHub Actions has broken in some way.


30 changes: 30 additions & 0 deletions .github/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
- name: defect
color: d73a4a
description: Something isn't working

- name: documentation
color: 0075ca
description: Improvements or additions to documentation

- name: duplicate
color: cfd3d7
description: This issue or pull request already exists

- name: enhancement
color: a2eeef
description: New feature or request

- name: invalid
color: e4e669
description: This doesn't seem right

- name: problem
color: BFD4F2

- name: question
color: d876e3
description: Further information is requested

- name: wontfix
color: ffffff
description: This will not be worked on
2 changes: 1 addition & 1 deletion .github/release_template.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
This is one of a suite of terraform related actions - find them at [dflook/terraform-github-actions](https://github.com/dflook/terraform-github-actions).

You can see the changes for this release in the [CHANGELOG](https://github.com/dflook/terraform-github-actions/blob/master/CHANGELOG.md)
You can see the changes for this release in the [CHANGELOG](https://github.com/dflook/terraform-github-actions/blob/main/CHANGELOG.md)

You can specify the action version as:

Expand Down
25 changes: 21 additions & 4 deletions .github/workflows/base-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ name: Update base image
on:
push:
branches:
- master
- main
paths:
- image/Dockerfile-base
- .github/workflows/base-image.yaml
schedule:
- cron: 0 1 * * 1

jobs:
push_image:
Expand All @@ -24,9 +27,23 @@ jobs:

- name: Base image
run: |
docker build --tag dflook/terraform-github-actions-base -f image/Dockerfile-base image
docker pull --quiet debian:bullseye-slim
BASE_DIGEST="$(docker image inspect --format="{{index .RepoDigests 0}}" "debian:bullseye-slim" | sed 's/.*@//')"

docker build --tag dflook/terraform-github-actions-base -f image/Dockerfile-base \
--label org.opencontainers.image.created="$(date '+%Y-%m-%dT%H:%M:%S%z')" \
--label org.opencontainers.image.source="https://github.com/${{ github.repository }}" \
--label org.opencontainers.image.revision="${{ github.sha }}" \
--label org.opencontainers.image.base.name="docker.io/library/debian:bullseye-slim" \
--label org.opencontainers.image.base.digest="$BASE_DIGEST" \
--label build="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" \
image

docker tag dflook/terraform-github-actions-base danielflook/terraform-github-actions-base:latest
docker push danielflook/terraform-github-actions-base:latest
docker push --quiet danielflook/terraform-github-actions-base:latest

IMAGE_DIGEST="$(docker image inspect --format="{{index .RepoDigests 0}}" "danielflook/terraform-github-actions-base:latest" | sed 's/.*@//')"
echo "::set-output name=digest::$IMAGE_DIGEST"

docker tag dflook/terraform-github-actions-base danielflook/terraform-github-actions-base:$GITHUB_RUN_ID
docker push danielflook/terraform-github-actions-base:$GITHUB_RUN_ID
docker push --quiet danielflook/terraform-github-actions-base:$GITHUB_RUN_ID
20 changes: 20 additions & 0 deletions .github/workflows/labels.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Update labels

on:
push:
branches:
- master
paths:
- .github/labels.yml

jobs:
labeler:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Run Labeler
uses: crazy-max/ghaction-github-labeler@52525cb66833763f651fc34e244e4f73b6e07ff5
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
34 changes: 34 additions & 0 deletions .github/workflows/pull_request_review.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: pull_request_review test

on:
- pull_request_review

jobs:
apply:
runs-on: ubuntu-latest
name: Apply approved changes on pull_request_review
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Plan
uses: ./terraform-plan
with:
label: pull_request_review
path: tests/workflows/pull_request_review

- name: Apply
uses: ./terraform-apply
id: output
with:
label: pull_request_review
path: tests/workflows/pull_request_review

- name: Verify outputs
run: |
if [[ "${{ steps.output.outputs.output_string }}" != "the_string" ]]; then
echo "::error:: output s not set correctly"
exit 1
fi
27 changes: 27 additions & 0 deletions .github/workflows/pull_request_review_trigger.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Trigger pull_request_review

on:
- pull_request

jobs:
required_version:
runs-on: ubuntu-latest
name: pull_request_review
steps:
- name: Trigger pull_request_review event
run: |
cat >review.json <<EOF
{
"body": "Triggering pull_request_review event...",
"event": "COMMENT"
}
EOF

curl \
--request POST \
-H "Authorization: token ${{ secrets.REVIEW_GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
-H "User-Agent: terraform-github-actions" \
-H "Content-Type: application/json" \
--data-binary @review.json \
${{ github.event.pull_request.url }}/reviews
34 changes: 34 additions & 0 deletions .github/workflows/pull_request_target.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: pull_request_target test

on:
- pull_request_target

jobs:
apply:
runs-on: ubuntu-latest
name: Apply approved changes on pull_request_target
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Plan
uses: ./terraform-plan
with:
label: pull_request_target
path: tests/workflows/pull_request_target

- name: Apply
uses: ./terraform-apply
id: output
with:
label: pull_request_target
path: tests/workflows/pull_request_target

- name: Verify outputs
run: |
if [[ "${{ steps.output.outputs.output_string }}" != "the_string" ]]; then
echo "::error:: output s not set correctly"
exit 1
fi
77 changes: 35 additions & 42 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,85 +2,78 @@ name: Release

on:
release:
types: [released]
types:
- released

jobs:
image:
runs-on: ubuntu-latest
name: Publish Docker Image
name: Release Actions
env:
GITHUB_TOKEN: ${{ github.token }}
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Registry login
env:
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
run: |
echo $GITHUB_TOKEN | docker login docker.pkg.github.com -u dflook --password-stdin
echo $GITHUB_TOKEN | docker login ghcr.io -u dflook --password-stdin
echo $DOCKER_TOKEN | docker login --username danielflook --password-stdin

- name: Action image
- name: Build action image
id: image_build
run: |
docker build --tag dflook/terraform-github-actions-base -f image/Dockerfile-base image
RELEASE_TAG="${{ github.event.release.tag_name }}"

RELEASE_TAG=$(cat $GITHUB_EVENT_PATH | jq -r '.release.tag_name' $GITHUB_EVENT_PATH)
docker pull --quiet danielflook/terraform-github-actions-base:latest
BASE_DIGEST="$(docker image inspect --format="{{index .RepoDigests 0}}" "danielflook/terraform-github-actions-base:latest" | sed 's/.*@//')"

docker build --tag dflook/terraform-github-actions \
--label org.opencontainers.image.created="$(date '+%Y-%m-%dT%H:%M:%S%z')" \
--label org.opencontainers.image.source="github.com/${{ github.repository }}.git" \
--label org.opencontainers.image.source="https://github.com/${{ github.repository }}" \
--label org.opencontainers.image.revision="${{ github.sha }}" \
--label vcs-ref="$RELEASE_TAG" \
--label build="$GITHUB_RUN_ID" \
--label org.opencontainers.image.base.name="docker.io/danielflook/terraform-github-actions-base:latest" \
--label org.opencontainers.image.base.digest="$BASE_DIGEST" \
--label build="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" \
image

docker tag dflook/terraform-github-actions docker.pkg.github.com/dflook/terraform-github-actions/action:$RELEASE_TAG
docker push docker.pkg.github.com/dflook/terraform-github-actions/action:$RELEASE_TAG
docker tag dflook/terraform-github-actions ghcr.io/dflook/terraform-github-actions:$RELEASE_TAG
docker push --quiet ghcr.io/dflook/terraform-github-actions:$RELEASE_TAG

docker tag dflook/terraform-github-actions danielflook/terraform-github-actions:$RELEASE_TAG
docker push danielflook/terraform-github-actions:$RELEASE_TAG
docker push --quiet danielflook/terraform-github-actions:$RELEASE_TAG

release_actions:
runs-on: ubuntu-latest
name: Release Actions
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
needs: image
steps:
- name: Checkout
uses: actions/checkout@v2
echo "::set-output name=digest::$(docker image inspect --format="{{index .RepoDigests 0}}" "danielflook/terraform-github-actions:$RELEASE_TAG")"

- name: Action image
- name: Release actions
run: |
export RELEASE_TAG=$(cat $GITHUB_EVENT_PATH | jq -r '.release.tag_name' $GITHUB_EVENT_PATH)
export RELEASE_TAG="${{ github.event.release.tag_name }}"
export major=`echo $RELEASE_TAG | cut -d. -f1`
export minor=`echo $RELEASE_TAG | cut -d. -f2`

git config --global user.name "Daniel Flook"
git config --global user.email "daniel@flook.org"

for action in $(find . -name action.yaml -printf "%h\n" | sed 's/^.\///'); do
for action in $(cd $GITHUB_WORKSPACE && find . -name action.yaml -printf "%h\n" | sed 's/^.\///'); do

if git clone https://dflook:$GITHUB_TOKEN@github.com/dflook/$action.git "$HOME/$action"; then
echo "Releasing dflook/$action@$RELEASE_TAG"

rsync -r $action/ $HOME/$action

sed -i "s|../image/Dockerfile|docker://danielflook/terraform-github-actions:$RELEASE_TAG|" $HOME/$action/action.yaml
rsync -r $GITHUB_WORKSPACE/$action/ $HOME/$action

export major=`echo $RELEASE_TAG | cut -d. -f1`
export minor=`echo $RELEASE_TAG | cut -d. -f2`
sed -i "s|../image/Dockerfile|docker://${{ steps.image_build.outputs.digest }}|" $HOME/$action/action.yaml

(cd "$HOME/$action" \
&& git add -A \
&& git commit -m "$RELEASE_TAG" \
&& git tag --force -a -m"$RELEASE_TAG" "$RELEASE_TAG" \
&& git tag --force -a -m"$RELEASE_TAG" "$major" \
&& git tag --force -a -m"$RELEASE_TAG" "$major.$minor" \
&& git push --force \
&& git push --force --tags
)
git -C "$HOME/$action" add -A
git -C "$HOME/$action" commit -m "$RELEASE_TAG"
git -C "$HOME/$action" tag --force -a -m"$RELEASE_TAG" "$RELEASE_TAG"
git -C "$HOME/$action" tag --force -a -m"$RELEASE_TAG" "$major"
git -C "$HOME/$action" tag --force -a -m"$RELEASE_TAG" "$major.$minor"
git -C "$HOME/$action" push --force
git -C "$HOME/$action" push --force --tags

cat .github/release_template.md \
cat $GITHUB_WORKSPACE/.github/release_template.md \
| envsubst \
| jq --slurp --raw-input --arg RELEASE_TAG "$RELEASE_TAG" '{"tag_name": $RELEASE_TAG, "name": $RELEASE_TAG, "body": . }' \
| curl -X POST \
Expand Down
Loading