Skip to content

allowCrossNamespaceImport, shorter resyncPeriod, update naming to avo… #744

allowCrossNamespaceImport, shorter resyncPeriod, update naming to avo…

allowCrossNamespaceImport, shorter resyncPeriod, update naming to avo… #744

name: Charts Update CI
on:
push:
branches-ignore:
- main
jobs:
update_schema_and_readme:
runs-on: ARM64
steps:
- name: Generate token
uses: actions/create-github-app-token@v1
id: generate_token
with:
app-id: ${{ secrets.GH_ACTIONS_HELPER_APP_ID }}
private-key: ${{ secrets.GH_ACTIONS_HELPER_PK }}
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ steps.generate_token.outputs.token }}
- uses: dorny/paths-filter@v3
id: filter
with:
initial-fetch-depth: '1'
list-files: json
filters: |
changed:
- added|modified: '**'
- uses: actions/github-script@v7
id: changed_charts
with:
script: |
const fs = require('fs');
const path = require("path");
const changedFiles = ${{ steps.filter.outputs.changed_files }}
const changedDirs = changedFiles.map(f => path.dirname(f)).filter(dir => fs.existsSync(path.join(dir, 'Chart.yaml')));
const uniqueChangedDirs = [...new Set(changedDirs)];
console.log(`Found the following changed charts: ${JSON.stringify(uniqueChangedDirs, null, 2)}\n OG: ${JSON.stringify(changedFiles, null, 2)} `)
core.setOutput('changed_chart_dirs', uniqueChangedDirs)
core.setOutput('changed_chart_dirs_bash', uniqueChangedDirs.join(' '));
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- run: |
pip install json-schema-for-humans
- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: '3.15.2'
- name: Install helm schema plugin
run: |
helm plugin install https://github.com/losisin/helm-values-schema-json.git
- name: Update values.schema.json
run: |
for chart in ${{ steps.changed_charts.outputs.changed_chart_dirs_bash }}
do
echo "Updating values.schema.json for ${chart}"
# Generate schema
cd ${chart} && make update-schema; cd -
# Generate README
generate-schema-doc ${chart}/values.schema.json ${chart}/README.md --config template_name=md --config show_toc=false --config with_footer=false
done
- name: Commit changes
uses: EndBug/add-and-commit@v9
with:
add: -A
message: 'chore: Update README/Schema for changed charts'