From e4be816b230d5049e7e2e4edc4aad1dd73a33f63 Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Fri, 23 May 2025 15:21:53 +0300 Subject: [PATCH 1/8] Use atmos to generate readme --- action.yml | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/action.yml b/action.yml index 5484042..9872dec 100644 --- a/action.yml +++ b/action.yml @@ -92,6 +92,18 @@ inputs: no-release readme + atmos-version: + description: The version of atmos to install + required: false + default: ">= 1.175.0" + + token: + description: + Used to pull node distributions for Atmos from Cloud Posse's GitHub repository. Since there's a default, this is typically + not supplied by the user. When running this action on github.com, the default value is sufficient. When running on + GHES, you can pass a personal access token for github.com if you are experiencing rate limiting. + default: ${{ github.server_url == 'https://github.com' && github.token || '' }} + outputs: banner_file: description: "Generated banner file path (if banner_enabled: true)" @@ -201,14 +213,12 @@ runs: viewportHeight: 320 omitBackground: true - - name: Initialize Makefile with `build-harness` support - if: inputs.readme_enabled == 'true' - shell: bash - run: | - if [[ ! -f Makefile ]]; then - echo '-include $(shell curl -sSL -o .build-harness "https://cloudposse.tools/build-harness"; echo .build-harness)' > Makefile - fi - make init + - name: Install Atmos + uses: cloudposse/github-action-setup-atmos@v2 + with: + atmos-version: ${{ inputs.atmos-version }} + token: ${{ inputs.token }} + install-wrapper: false - name: Update readme if: inputs.readme_enabled == 'true' @@ -217,7 +227,7 @@ runs: env: GITHUB_TOKEN: "${{ inputs.token }}" run: | - make readme/build + atmos docs generate readme # Ignore changes if they are only whitespace if ! git diff --quiet README.md && git diff --ignore-all-space --ignore-blank-lines --quiet README.md; then git restore README.md From a739c398c2ce2c42e8db08a7186bfe31fb9b69be Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Fri, 23 May 2025 15:24:16 +0300 Subject: [PATCH 2/8] Update action.yml --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 9872dec..a541d9e 100644 --- a/action.yml +++ b/action.yml @@ -98,7 +98,7 @@ inputs: default: ">= 1.175.0" token: - description: + description: |- Used to pull node distributions for Atmos from Cloud Posse's GitHub repository. Since there's a default, this is typically not supplied by the user. When running this action on github.com, the default value is sufficient. When running on GHES, you can pass a personal access token for github.com if you are experiencing rate limiting. From 5d0385576ffa418040c51efd8359adf49ac26cde Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Fri, 23 May 2025 15:25:57 +0300 Subject: [PATCH 3/8] Update action.yml --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index a541d9e..291ef88 100644 --- a/action.yml +++ b/action.yml @@ -95,7 +95,7 @@ inputs: atmos-version: description: The version of atmos to install required: false - default: ">= 1.175.0" + default: '>= 1.175.0' token: description: |- From 636f2a04060fc955a86252ff08f79e9eb45d47f8 Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Fri, 23 May 2025 15:30:54 +0300 Subject: [PATCH 4/8] Update action.yml --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 291ef88..7a430a0 100644 --- a/action.yml +++ b/action.yml @@ -98,7 +98,7 @@ inputs: default: '>= 1.175.0' token: - description: |- + description: Used to pull node distributions for Atmos from Cloud Posse's GitHub repository. Since there's a default, this is typically not supplied by the user. When running this action on github.com, the default value is sufficient. When running on GHES, you can pass a personal access token for github.com if you are experiencing rate limiting. From 54f71e68a6a7e5bfcd1b02cfedc010fef76b1f23 Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Fri, 23 May 2025 15:31:55 +0300 Subject: [PATCH 5/8] Update action.yml --- action.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/action.yml b/action.yml index 7a430a0..d59605c 100644 --- a/action.yml +++ b/action.yml @@ -97,13 +97,6 @@ inputs: required: false default: '>= 1.175.0' - token: - description: - Used to pull node distributions for Atmos from Cloud Posse's GitHub repository. Since there's a default, this is typically - not supplied by the user. When running this action on github.com, the default value is sufficient. When running on - GHES, you can pass a personal access token for github.com if you are experiencing rate limiting. - default: ${{ github.server_url == 'https://github.com' && github.token || '' }} - outputs: banner_file: description: "Generated banner file path (if banner_enabled: true)" From 386eb845eb426623a0ef0511a7307b56297807a6 Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Sat, 24 May 2025 00:34:51 +0300 Subject: [PATCH 6/8] Update README.yaml --- README.yaml | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/README.yaml b/README.yaml index 9a3fefe..4d677e6 100644 --- a/README.yaml +++ b/README.yaml @@ -113,8 +113,39 @@ usage: |- banner_enabled: true readme_enabled: true ``` + + ### Migrating from `v0` to `v1` + + `v1` use [atmos](https://atmos.tools/cli/commands/docs/generate) instead of [build-harness](https://github.com/cloudposse/build-harness). + You can drop `Makefile` if you use it only for readme generation. + To support atmos reaadme generation, you must create `atmos.yaml` config. + The configuration depends on your repo - please follow this [documentation](https://atmos.tools/cli/commands/docs/generate) + + Example: + + ```yaml filename="atmos.yaml" + docs: + generate: + readme: + base-dir: . + input: + - "./README.yaml" + template: "https://.../README.md.gotmpl" + output: "./README.md" + terraform: + source: src/ + enabled: false + format: "markdown" + show_providers: false + show_inputs: true + show_outputs: true + sort_by: "name" + hide_empty: false + indent_level: 2 + ``` + include: - "docs/github-action.md" # Contributors to this project -contributors: [] \ No newline at end of file +contributors: [] From 456825259dedff64d9ca5ad482f68b9fa387f518 Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Mon, 26 May 2025 17:55:49 +0200 Subject: [PATCH 7/8] Parameterize atmos docs generate target --- action.yml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/action.yml b/action.yml index d59605c..dadd6fe 100644 --- a/action.yml +++ b/action.yml @@ -38,6 +38,10 @@ inputs: required: false default: 'true' + target: + description: "Configuration name" + required: true + validate_readme: required: false default: 'true' @@ -220,13 +224,15 @@ runs: env: GITHUB_TOKEN: "${{ inputs.token }}" run: | - atmos docs generate readme + output_file=$(atmos docs generate readme 2>&1 | sed -n -e "s/^.*output=//p") + # Get relative path from absolute + output_file=$(realpath -s --relative-to="$PWD" "$output_file") # Ignore changes if they are only whitespace - if ! git diff --quiet README.md && git diff --ignore-all-space --ignore-blank-lines --quiet README.md; then - git restore README.md - echo Ignoring whitespace-only changes in README + if ! git diff --quiet ${output_file} && git diff --ignore-all-space --ignore-blank-lines --quiet ${output_file}; then + git restore ${output_file} + echo Ignoring whitespace-only changes in generated file fi - echo "file=README.md" >> $GITHUB_OUTPUT + echo "file=${output_file}" >> $GITHUB_OUTPUT - uses: gaurav-nelson/github-action-markdown-link-check@v1 if: inputs.readme_enabled == 'true' && inputs.validate_readme == 'true' From 189f9c5f137f2a782c65ec9a45d089105d02ddfe Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Mon, 26 May 2025 17:56:13 +0200 Subject: [PATCH 8/8] Parameterize atmos docs generate target --- action.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index dadd6fe..c76a76d 100644 --- a/action.yml +++ b/action.yml @@ -41,6 +41,7 @@ inputs: target: description: "Configuration name" required: true + default: 'readme' validate_readme: required: false @@ -224,7 +225,7 @@ runs: env: GITHUB_TOKEN: "${{ inputs.token }}" run: | - output_file=$(atmos docs generate readme 2>&1 | sed -n -e "s/^.*output=//p") + output_file=$(atmos docs generate ${{ inputs.target }} 2>&1 | sed -n -e "s/^.*output=//p") # Get relative path from absolute output_file=$(realpath -s --relative-to="$PWD" "$output_file") # Ignore changes if they are only whitespace