chore: init #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: apply | |
on: | |
workflow_call: | |
inputs: | |
targets: | |
required: false | |
secrets: | |
gh_token: | |
required: false | |
gh_app_id: | |
required: false | |
gh_app_private_key: | |
required: false | |
terraform_private_module_ssh_key: # This isn't needed if you don't use SSH key to checkout private Terraform Modules | |
required: false | |
secrets: | |
required: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TFACTION_IS_APPLY: 'true' | |
permissions: | |
id-token: write | |
contents: read | |
issues: read # this is required to `gh pr list`'s `-l` option | |
pull-requests: write | |
apply: | |
name: "apply (${{matrix.target.target}})" | |
runs-on: ${{matrix.target.runs_on}} | |
needs: setup | |
# if services is empty, the build job is skipped | |
if: "join(fromJSON(inputs.targets), '') != ''" | |
strategy: | |
fail-fast: false | |
matrix: | |
target: ${{fromJSON(inputs.targets)}} | |
env: | |
TFACTION_TARGET: ${{matrix.target.target}} | |
TFACTION_JOB_TYPE: ${{matrix.target.job_type}} | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Generate token | |
id: generate_token | |
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0 | |
with: | |
app_id: ${{ secrets.APP_ID }} | |
private_key: ${{ secrets.APP_PRIVATE_KEY }} | |
- uses: aquaproj/aqua-installer@d9c4b5d107a17831a8c8718efa4ce67a0923d1f5 # v2.1.3 | |
with: | |
aqua_version: v2.16.4 | |
- uses: suzuki-shunsuke/tfaction/export-secrets@26effa08b92b77b5cfe04e2a25c15845fd00b04f # v0.7.2 | |
with: | |
secrets: ${{ toJSON(secrets) }} | |
# This is required to download private modules in `terraform init` | |
- run: gh auth setup-git | |
env: | |
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} | |
- run: tfaction get-or-create-drift-issue | |
shell: bash | |
env: | |
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} | |
- uses: suzuki-shunsuke/tfaction/setup@26effa08b92b77b5cfe04e2a25c15845fd00b04f # v0.7.2 | |
with: | |
github_app_token: ${{ steps.generate_token.outputs.token }} | |
ssh_key: ${{ secrets.TERRAFORM_PRIVATE_MODULE_SSH_KEY }} # This isn't needed if you don't use SSH key to checkout private Terraform Modules | |
- uses: suzuki-shunsuke/tfaction/apply@5731fade20e41c1905c04095f0e3d68fac14a636 # v0.7.3 | |
with: | |
github_app_token: ${{ steps.generate_token.outputs.token }} | |
- uses: suzuki-shunsuke/tfaction/create-follow-up-pr@26effa08b92b77b5cfe04e2a25c15845fd00b04f # v0.7.2 | |
if: failure() | |
with: | |
github_app_token: ${{ steps.generate_token.outputs.token }} | |
- uses: suzuki-shunsuke/tfaction/update-drift-issue@26effa08b92b77b5cfe04e2a25c15845fd00b04f # v0.7.2 | |
if: always() | |
with: | |
status: ${{job.status}} | |
github_token: ${{steps.generate_token.outputs.token}} |