Skip to content

Commit 0660d6d

Browse files
committed
feat(helm): add action to generate chart documentation
Signed-off-by: Emilien Escalle <emilien.escalle@escemi.com>
1 parent 52462fd commit 0660d6d

6 files changed

Lines changed: 106 additions & 4 deletions

File tree

.github/workflows/__pull-request-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ on: # yamllint disable-line rule:truthy
88

99
permissions:
1010
actions: read
11-
contents: read
11+
contents: write
1212
issues: read
1313
packages: write
14-
pull-requests: read
14+
pull-requests: write
1515
security-events: write
1616
statuses: write
1717
# FIXME: This is a workaround for having workflow actions. See https://github.com/orgs/community/discussions/38659

.github/workflows/__shared-ci.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ on: # yamllint disable-line rule:truthy
66

77
permissions:
88
actions: read
9-
contents: read
9+
contents: write
1010
issues: read
1111
packages: write
12-
pull-requests: read
12+
pull-requests: write
1313
security-events: write
1414
statuses: write
1515
# yamllint disable-line rule:line-length
@@ -42,6 +42,11 @@ jobs:
4242
needs: linter
4343
uses: ./.github/workflows/__test-action-get-image-name.yml
4444

45+
test-action-helm-generate-docs:
46+
needs: linter
47+
uses: ./.github/workflows/__test-action-helm-generate-docs.yml
48+
secrets: inherit
49+
4550
test-action-helm-parse-chart-uri:
4651
needs: linter
4752
uses: ./.github/workflows/__test-action-helm-parse-chart-uri.yml
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: Test for "helm/generate-docs" action
3+
run-name: Test for "helm/generate-docs" action
4+
5+
on: # yamllint disable-line rule:truthy
6+
workflow_call:
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
jobs:
13+
tests:
14+
name: Test for "helm/generate-docs" action
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
18+
19+
- id: generate-docs
20+
uses: ./actions/helm/generate-docs
21+
with:
22+
working-directory: ./tests/charts
23+
github-token: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ Opinionated GitHub Actions and workflows for continuous integration in container
2525

2626
### Helm
2727

28+
#### - [Generate chart documentation](actions/helm/generate-docs/README.md)
29+
2830
#### - [Parse chart URI](actions/helm/parse-chart-uri/README.md)
2931

3032
#### - [Release chart](actions/helm/release-chart/README.md)
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!-- start title -->
2+
<!-- end title -->
3+
<!--
4+
// jscpd:ignore-start
5+
-->
6+
<!-- markdownlint-disable MD013 -->
7+
<!-- start badges -->
8+
<!-- end badges -->
9+
<!-- markdownlint-enable MD013 -->
10+
<!--
11+
// jscpd:ignore-end
12+
-->
13+
<!-- start description -->
14+
<!-- end description -->
15+
<!-- start contents -->
16+
<!-- end contents -->
17+
<!-- start usage -->
18+
<!-- end usage -->
19+
<!-- start inputs -->
20+
<!-- end inputs -->
21+
<!-- start outputs -->
22+
<!-- end outputs -->
23+
<!-- start [.github/ghadocs/examples/] -->
24+
<!-- end [.github/ghadocs/examples/] -->
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
name: "Helm - Generate Chart Documentation"
3+
description: |
4+
Action to generate documentation for a Helm chart.
5+
It will generate the documentation in the `docs/` directory of the chart.
6+
Mainly using [losisin/helm-docs-github-action](https://github.com/losisin/helm-docs-github-action).
7+
author: Hoverkraft
8+
branding:
9+
icon: book-open
10+
color: blue
11+
12+
inputs:
13+
working-directory:
14+
description: "Working directory"
15+
required: false
16+
default: "${{ github.workspace }}"
17+
github-token:
18+
description: |
19+
GitHub Token to create and merge pull request.
20+
Permissions:
21+
- contents: write
22+
- pull-requests: write
23+
default: ${{ github.token }}
24+
25+
runs:
26+
using: "composite"
27+
steps:
28+
- shell: bash
29+
id: prepare-variables
30+
run: |
31+
echo "working-directory-name=$(basename "${{ inputs.working-directory }}")" >> "$GITHUB_OUTPUT"
32+
33+
- uses: hoverkraft-tech/ci-github-common/actions/checkout@9a3d71ca9f68bc1061db8ea1442084ac31a0f8bf # 0.23.0
34+
35+
- uses: losisin/helm-docs-github-action@8dc2304e986afbbb0b7db0a9980b6bf68c1307cf # v1.5.2
36+
with:
37+
chart-search-root: ${{ inputs.working-directory }}
38+
39+
- uses: hoverkraft-tech/ci-github-common/actions/create-and-merge-pull-request@9a3d71ca9f68bc1061db8ea1442084ac31a0f8bf # 0.23.0
40+
with:
41+
github-token: ${{ inputs.github-token }}
42+
branch: docs/update-helm-chart-docs-${{ steps.prepare-variables.outputs.working-directory-name }}
43+
title: "docs: update Helm chart documentation for ${{ steps.prepare-variables.outputs.working-directory-name }}"
44+
body: Clean review apps of ${{ github.event.client_payload.repository }}
45+
commit-message: |
46+
docs: update Helm chart documentation for ${{ steps.prepare-variables.outputs.working-directory-name }}
47+
48+
[skip ci]

0 commit comments

Comments
 (0)