[修正] podのstatusを更新できなくてmattermostが再起動を繰り返していたため修正 #71
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: Plan(IAM mode) | |
on: | |
pull_request: | |
branches: | |
- master | |
jobs: | |
plan: | |
permissions: | |
id-token: write | |
pull-requests: write | |
name: Plan | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
dir: [ | |
terraform/iam | |
] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Check diff | |
id: diff | |
uses: technote-space/[email protected] | |
with: | |
PATTERNS: | | |
${{ matrix.dir }}/**/*.tf | |
- name: Authenticate to GCP | |
if: env. GIT_DIFF_FILTERED | |
id: gcp_auth | |
uses: google-github-actions/[email protected] | |
with: | |
create_credentials_file: 'true' | |
workload_identity_provider: projects/233207969476/locations/global/workloadIdentityPools/github-action/providers/github-action-provider | |
service_account: [email protected] | |
access_token_lifetime: 1200s | |
- name: gcloud auth login by workload identity | |
if: env. GIT_DIFF_FILTERED | |
run: |- | |
gcloud auth login --brief --cred-file="${{ steps.gcp_auth.outputs.credentials_file_path }}" | |
- name: Setup terraform | |
if: env. GIT_DIFF_FILTERED | |
uses: hashicorp/[email protected] | |
with: | |
terraform_version: 1.0.11 | |
- name: Check format | |
id: fmt | |
if: env. GIT_DIFF_FILTERED | |
run: terraform fmt -check -recursive | |
working-directory: ${{ matrix.dir }} | |
- name: Initialize | |
id: init | |
if: env. GIT_DIFF_FILTERED | |
run: terraform init | |
working-directory: ${{ matrix.dir }} | |
- name: Download modules | |
if: env. GIT_DIFF_FILTERED | |
run: terraform get | |
working-directory: ${{ matrix.dir }} | |
- name: Validate | |
if: env. GIT_DIFF_FILTERED | |
run: terraform validate -no-color | |
working-directory: ${{ matrix.dir }} | |
- name: Plan | |
if: env. GIT_DIFF_FILTERED | |
id: plan | |
run: terraform plan -no-color | |
working-directory: ${{ matrix.dir }} | |
continue-on-error: true | |
- name: Comment | |
if: env. GIT_DIFF_FILTERED | |
uses: actions/[email protected] | |
env: | |
PLAN: "terraform\n${{ steps.plan.outputs.stdout }}" | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const output = `## ⚠️⚠️⚠️\`${{ matrix.dir }}\`⚠️⚠️⚠️ | |
#### Terraform Format and Style 🖌\`${{ steps.fmt.outcome }}\` | |
#### Terraform Plan 📖\`${{ steps.plan.outcome }}\` | |
<details><summary>Show Plan</summary> | |
\`\`\`${process.env.PLAN}\`\`\` | |
</details>`; | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: output | |
}) |