diff --git a/.github/workflows/__main-ci.yml b/.github/workflows/__main-ci.yml index 868a863e..7d109cec 100644 --- a/.github/workflows/__main-ci.yml +++ b/.github/workflows/__main-ci.yml @@ -53,6 +53,17 @@ jobs: "test-build-args-secrets" ] + helm-docs: + needs: ci + if: github.event_name != 'schedule' + runs-on: ubuntu-latest + steps: + - uses: ./actions/helm/generate-docs + with: + working-directory: ./tests/charts + github-app-id: ${{ vars.CI_BOT_APP_ID }} + github-app-key: ${{ secrets.CI_BOT_APP_PRIVATE_KEY }} + release: needs: ci if: github.event_name != 'schedule' diff --git a/.github/workflows/__pull-request-ci.yml b/.github/workflows/__pull-request-ci.yml index aadda9d0..503fc586 100644 --- a/.github/workflows/__pull-request-ci.yml +++ b/.github/workflows/__pull-request-ci.yml @@ -8,10 +8,10 @@ on: # yamllint disable-line rule:truthy permissions: actions: read - contents: read + contents: write issues: read packages: write - pull-requests: read + pull-requests: write security-events: write statuses: write # FIXME: This is a workaround for having workflow actions. See https://github.com/orgs/community/discussions/38659 diff --git a/README.md b/README.md index c4ee6834..68c14827 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,8 @@ Opinionated GitHub Actions and workflows for continuous integration in container ### Helm +#### - [Generate chart documentation](actions/helm/generate-docs/README.md) + #### - [Parse chart URI](actions/helm/parse-chart-uri/README.md) #### - [Release chart](actions/helm/release-chart/README.md) diff --git a/actions/helm/generate-docs/README.md b/actions/helm/generate-docs/README.md new file mode 100644 index 00000000..4032066b --- /dev/null +++ b/actions/helm/generate-docs/README.md @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/actions/helm/generate-docs/action.yml b/actions/helm/generate-docs/action.yml new file mode 100644 index 00000000..3e357e9b --- /dev/null +++ b/actions/helm/generate-docs/action.yml @@ -0,0 +1,66 @@ +--- +name: "Helm - Generate Chart Documentation" +description: | + Action to generate documentation for a Helm chart. + It will generate the documentation in the `docs/` directory of the chart. + Mainly using [losisin/helm-docs-github-action](https://github.com/losisin/helm-docs-github-action). +author: Hoverkraft +branding: + icon: book-open + color: blue + +inputs: + working-directory: + description: "Working directory" + required: false + default: "${{ github.workspace }}" + github-token: + description: | + GitHub Token to create and merge pull request. + Permissions: + - contents: write + - pull-requests: write + default: ${{ github.token }} + github-app-id: + description: | + GitHub App ID to generate GitHub token in place of github-token. + See . + required: false + github-app-key: + description: | + GitHub App private key to generate GitHub token in place of github-token. + See . + required: false + +runs: + using: "composite" + steps: + - shell: bash + id: prepare-variables + run: | + echo "working-directory-name=$(basename "${{ inputs.working-directory }}")" >> "$GITHUB_OUTPUT" + + - uses: hoverkraft-tech/ci-github-common/actions/checkout@9a3d71ca9f68bc1061db8ea1442084ac31a0f8bf # 0.23.0 + + - uses: losisin/helm-docs-github-action@8dc2304e986afbbb0b7db0a9980b6bf68c1307cf # v1.5.2 + with: + chart-search-root: ${{ inputs.working-directory }} + + - uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6 + if: inputs.github-app-id + id: generate-token + with: + app-id: ${{ inputs.github-app-id }} + private-key: ${{ inputs.github-app-key }} + + - uses: hoverkraft-tech/ci-github-common/actions/create-and-merge-pull-request@9a3d71ca9f68bc1061db8ea1442084ac31a0f8bf # 0.23.0 + with: + github-token: ${{ steps.generate-token.outputs.token || inputs.github-token }} + branch: docs/update-helm-chart-docs-${{ steps.prepare-variables.outputs.working-directory-name }} + title: "docs: update Helm chart documentation for ${{ steps.prepare-variables.outputs.working-directory-name }}" + body: | + This pull request updates the documentation for the Helm chart `${{ steps.prepare-variables.outputs.working-directory-name }}`. + commit-message: | + docs: update Helm chart documentation for ${{ steps.prepare-variables.outputs.working-directory-name }} + + [skip ci] diff --git a/actions/helm/parse-chart-uri/README.md b/actions/helm/parse-chart-uri/README.md index 83451470..18218389 100644 --- a/actions/helm/parse-chart-uri/README.md +++ b/actions/helm/parse-chart-uri/README.md @@ -44,7 +44,7 @@ This action does not requires any permissions. | **Input** | **Description** | **Default** | **Required** | | ---------------- | ------------------ | ----------- | ------------ | -| uri | Chart URI to parse | | **true** | +| URI | Chart URI to parse | | **true** |