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

chore: avoid update-docs workflow runs on pushes to main #3617

Merged
merged 14 commits into from
Nov 22, 2023
22 changes: 3 additions & 19 deletions .github/workflows/update-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,34 +16,18 @@ jobs:
name: Auto update terraform docs
runs-on: ubuntu-latest
steps:
- name: Get installation token
npalm marked this conversation as resolved.
Show resolved Hide resolved
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
uses: terraform-docs/gh-actions@f6d59f89a280fa0a3febf55ef68f146784b20ba0 # ratchet:terraform-docs/gh-actions@v1.0.0
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' }}

- 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
npalm marked this conversation as resolved.
Show resolved Hide resolved
with:
token: ${{ steps.token.outputs.token || secrets.GITHUB_TOKEN }}
npalm marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
2 changes: 1 addition & 1 deletion examples/default/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ terraform output webhook_secret

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_environment"></a> [environment](#input\_environment) | Environment name, used as prefix | `string` | `null` | no |
| <a name="input_environment"></a> [environment](#input\_environment) | Environment name, used as prefix. | `string` | `null` | no |
| <a name="input_github_app"></a> [github\_app](#input\_github\_app) | GitHub for API usages. | <pre>object({<br> id = string<br> key_base64 = string<br> })</pre> | n/a | yes |

## Outputs
Expand Down
2 changes: 1 addition & 1 deletion examples/default/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ variable "github_app" {
}

variable "environment" {
description = "Environment name, used as prefix"
description = "Environment name, used as prefix."
npalm marked this conversation as resolved.
Show resolved Hide resolved

type = string
default = null
Expand Down