From a5c8450249cb7d01b29cef51043947b1b5089457 Mon Sep 17 00:00:00 2001 From: tom-hauschke Date: Tue, 31 Oct 2023 14:02:32 +0100 Subject: [PATCH] chore: updated and formatted github actions (#11) Signed-off-by: tom-hauschke --- .github/workflows/check_tf_docs.yaml | 14 ++++++++++++++ .github/workflows/generate_tf_docs.yaml | 20 -------------------- .github/workflows/pull_request_labels.yaml | 3 --- .github/workflows/tests.yaml | 15 ++++----------- 4 files changed, 18 insertions(+), 34 deletions(-) create mode 100644 .github/workflows/check_tf_docs.yaml delete mode 100644 .github/workflows/generate_tf_docs.yaml diff --git a/.github/workflows/check_tf_docs.yaml b/.github/workflows/check_tf_docs.yaml new file mode 100644 index 0000000..12169fd --- /dev/null +++ b/.github/workflows/check_tf_docs.yaml @@ -0,0 +1,14 @@ +name: Check if terraform docs are updated +on: pull_request +jobs: + docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.ref }} + - name: Check if terraform docs inside the README.md are updated + uses: terraform-docs/gh-actions@v1.0.0 + with: + working-dir: . + fail-on-diff: true diff --git a/.github/workflows/generate_tf_docs.yaml b/.github/workflows/generate_tf_docs.yaml deleted file mode 100644 index f4826ec..0000000 --- a/.github/workflows/generate_tf_docs.yaml +++ /dev/null @@ -1,20 +0,0 @@ -name: Generate terraform docs -on: - - pull_request -jobs: - docs: - runs-on: ubuntu-latest - permissions: - contents: write - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.ref }} - - - name: Render terraform docs inside the README.md and push changes back to PR branch - uses: terraform-docs/gh-actions@v1.0.0 - with: - working-dir: . - output-file: README.md - output-method: inject - git-push: "true" diff --git a/.github/workflows/pull_request_labels.yaml b/.github/workflows/pull_request_labels.yaml index 26eb280..0da857a 100644 --- a/.github/workflows/pull_request_labels.yaml +++ b/.github/workflows/pull_request_labels.yaml @@ -1,7 +1,5 @@ name: Pull Request Labels - on: pull_request - jobs: size-label: runs-on: ubuntu-latest @@ -14,7 +12,6 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} IGNORED: "README.md\nLICENSE\n.gitignore\n.github/**\n" - pr-labeler: runs-on: ubuntu-latest permissions: diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index b8ff66f..4d39bf1 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -1,7 +1,5 @@ name: Linting and formatting tests - on: pull_request - jobs: test: name: test @@ -9,29 +7,24 @@ jobs: steps: - uses: actions/checkout@v4 - name: Setup Terraform - uses: hashicorp/setup-terraform@v2 - # with: - # terraform_version: 1.4.2 - + uses: hashicorp/setup-terraform@v3 - name: Terraform Init id: init run: terraform init - - name: Terraform Format id: fmt run: terraform fmt -check - - name: Terraform Validate id: validate run: terraform validate -no-color - - name: Comment PR - if: (steps.init.outcome == 'failure' || steps.fmt.outcome == 'failure' || steps.validate.outcome == 'failure') && github.event_name == 'pull_request' + if: (steps.init.outcome == 'failure' || steps.fmt.outcome == 'failure' || steps.validate.outcome == 'failure') && + github.event_name == 'pull_request' uses: thollander/actions-comment-pull-request@v2 with: pr_number: ${{ github.event.pull_request.number }} comment_tag: test-chart - message: | + message: |- # :x: Terraform Linting, Formatting or Init Failed #### Terraform Initialization \`${{ steps.init.outcome }}\`