From 13b1894baa21e426760ce7209f798c2d139ee10c Mon Sep 17 00:00:00 2001 From: Niek Palm Date: Wed, 22 Nov 2023 13:31:53 +0100 Subject: [PATCH] chore: avoid update-docs workflow runs on pushes to main (#3617) Docs should be updated on branches, in case of the locked main branch a PR is created. This to ensure the main is up-to-date. --------- Co-authored-by: github-actions[bot] --- .github/workflows/update-docs.yml | 29 ++++++++--------------------- examples/arm64/README.md | 2 +- examples/arm64/variables.tf | 2 +- examples/default/README.md | 2 +- examples/default/variables.tf | 2 +- 5 files changed, 12 insertions(+), 25 deletions(-) diff --git a/.github/workflows/update-docs.yml b/.github/workflows/update-docs.yml index de2b23a6..261ed47e 100644 --- a/.github/workflows/update-docs.yml +++ b/.github/workflows/update-docs.yml @@ -16,23 +16,7 @@ jobs: name: Auto update terraform docs runs-on: ubuntu-latest steps: - - name: Get installation token - uses: philips-software/app-token-action@a37926571e4cec6f219e06727136efdd073d8657 # ratchet:philips-software/app-token-action@v1.1.2 - id: token - with: - app_id: ${{ secrets.FOREST_RELEASER_APP_ID }} - app_base64_private_key: ${{ secrets.FOREST_RELEASER_APP_PRIVATE_KEY_BASE64 }} - auth_type: installation - - # We use the app for branches in this this repo to ensure PR chekcs are kept in place. - - if: github.event_name == 'push' && github.repository_owner == 'philips-labs' && github.ref != 'refs/heads/main' - name: Checkout with App Token - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # ratchet:actions/checkout@v4 - with: - token: ${{ steps.token.outputs.token }} - - - if: (github.event_name == 'push' && github.repository_owner != 'philips-labs') || github.ref == 'refs/heads/main' - name: Checkout with GITHUB Action token + - name: Checkout with GITHUB Action token uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # ratchet:actions/checkout@v4 - name: Generate TF docs @@ -40,14 +24,17 @@ jobs: with: find-dir: . git-commit-message: "docs: auto update terraform docs" - git-push: ${{ github.ref != 'refs/heads/main' }} + git-push: ${{ github.ref != 'refs/heads/main' || github.repository_owner != 'philips-labs' }} + # change docs via PR in case of locked main branch - name: Create Pull Request (main branch only) - if: github.ref == 'refs/heads/main' + if: github.ref == 'refs/heads/main' && github.repository_owner == 'philips-labs' uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # ratchet:peter-evans/create-pull-request@v5.0.2 with: - token: ${{ steps.token.outputs.token || secrets.GITHUB_TOKEN }} + token: ${{ secrets.GITHUB_TOKEN }} commit-message: "Update Terraform docs" title: "docs: Update Terraform docs" - branch: ${{ github.event.pull_request.base.ref }}-update-docs + branch: update-docs + branch-suffix: random base: ${{ github.event.pull_request.base.ref }} + delete-branch: true diff --git a/examples/arm64/README.md b/examples/arm64/README.md index deeb87f5..e8a0e1bb 100644 --- a/examples/arm64/README.md +++ b/examples/arm64/README.md @@ -64,7 +64,7 @@ Be aware some shells will print some end of line character `%`. | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| -| [github\_app](#input\_github\_app) | GitHub for API usages. |
object({
id = string
key_base64 = string
})
| n/a | yes | +| [github\_app](#input\_github\_app) | GitHub App for API usages. |
object({
id = string
key_base64 = string
})
| n/a | yes | ## Outputs diff --git a/examples/arm64/variables.tf b/examples/arm64/variables.tf index d8b53564..35a65dbd 100644 --- a/examples/arm64/variables.tf +++ b/examples/arm64/variables.tf @@ -1,5 +1,5 @@ variable "github_app" { - description = "GitHub for API usages." + description = "GitHub App for API usages." type = object({ id = string diff --git a/examples/default/README.md b/examples/default/README.md index 1f00e519..e0e274fa 100644 --- a/examples/default/README.md +++ b/examples/default/README.md @@ -62,7 +62,7 @@ terraform output webhook_secret | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| -| [environment](#input\_environment) | Environment name, used as prefix | `string` | `null` | no | +| [environment](#input\_environment) | Environment name, used as prefix. | `string` | `null` | no | | [github\_app](#input\_github\_app) | GitHub for API usages. |
object({
id = string
key_base64 = string
})
| n/a | yes | ## Outputs diff --git a/examples/default/variables.tf b/examples/default/variables.tf index e8596eaf..48290ce8 100644 --- a/examples/default/variables.tf +++ b/examples/default/variables.tf @@ -8,7 +8,7 @@ variable "github_app" { } variable "environment" { - description = "Environment name, used as prefix" + description = "Environment name, used as prefix." type = string default = null