Helm Repo Init
A composite GitHub Action that bootstraps a new Helm chart repository created from the helmchart-repo-template.
It runs helm create, substitutes CHART_NAME/GITHUB_OWNER placeholders across all config files, generates artifacthub-pkg.yml and README.md.gotmpl, removes the init workflow, and commits everything in a single [skip ci] commit.
Prerequisites
- The repository must have been created from the
helmchart-repo-template. helmmust be available in the runner (useazure/setup-helm@v4before calling this action).- A token with
contents: writepermission to push the commit.
Usage
- name: Set up Helm
uses: azure/setup-helm@v4
- name: Initialise chart
uses: AutomationDojo/reusable-cicd/helm/repo-init@main
with:
commit-token: ${{ secrets.GITHUB_TOKEN }}
The full init workflow from the template:
name: Init Repository
on:
push:
branches: [main]
permissions:
contents: write
jobs:
init:
name: Initialise Helm chart from template
runs-on: ubuntu-latest
steps:
- name: Check if already initialised
id: check
run: |
if [ -d "charts/${{ github.event.repository.name }}" ]; then
echo "skip=true" >> "$GITHUB_OUTPUT"
else
echo "skip=false" >> "$GITHUB_OUTPUT"
fi
- name: Checkout
if: steps.check.outputs.skip == 'false'
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Helm
if: steps.check.outputs.skip == 'false'
uses: azure/setup-helm@v4
- name: Initialise chart
if: steps.check.outputs.skip == 'false'
uses: AutomationDojo/reusable-cicd/helm/repo-init@main
with:
commit-token: ${{ secrets.GITHUB_TOKEN }}
Inputs
| Input | Description | Required | Default |
|---|---|---|---|
chart-name |
Name of the Helm chart | No | Repository name |
github-owner |
GitHub owner / organisation | No | Repository owner |
chart-description |
Short description of the chart | No | Helm chart for <chart-name>. |
commit-token |
Token used to push the initialisation commit | Yes | — |
What it does
- Runs
helm create charts/<chart-name>to scaffold a fresh chart with the latest Helm defaults. - Removes
charts/.gitkeep(placeholder used to keep the directory tracked in git). - Substitutes
CHART_NAMEandGITHUB_OWNERplaceholders in:.releaserc.yaml.github/configs/cr.yaml.github/workflows/release.ymlmkdocs.ymldocs/index.md,docs/usage.md,docs/development.md
- Creates
charts/<chart-name>/artifacthub-pkg.ymlwith base Artifact Hub metadata. - Creates
charts/<chart-name>/README.md.gotmplforhelm-docs. - Deletes
.github/workflows/init-repo.yml(self-cleanup). - Commits and pushes all changes with
[skip ci].
Notes
- The action is idempotent in the sense that the calling workflow checks for the existence of
charts/<chart-name>/before invoking it — so it only runs once. - The
dist/bundle is pre-built and committed to the repository. Nonpm installis needed at runtime.