mirror of
https://github.com/bitnami/charts.git
synced 2026-03-05 06:47:25 +08:00
52 lines
2.0 KiB
YAML
52 lines
2.0 KiB
YAML
# Copyright VMware, Inc.
|
|
# SPDX-License-Identifier: APACHE-2.0
|
|
|
|
name: '[CI/CD] Update README metadata'
|
|
|
|
on:
|
|
pull_request_target:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- 'bitnami/*/values.yaml'
|
|
# Remove all permissions by default
|
|
permissions: {}
|
|
jobs:
|
|
update-readme-metadata:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- name: Install readme-generator-for-helm
|
|
run: npm install -g @bitnami/readme-generator-for-helm
|
|
- name: Checkout bitnami/charts
|
|
uses: actions/checkout@v3
|
|
with:
|
|
path: charts
|
|
ref: ${{github.event.pull_request.head.ref}}
|
|
repository: ${{github.event.pull_request.head.repo.full_name}}
|
|
token: ${{ github.actor == 'bitnami-bot' && secrets.GITHUB_TOKEN || secrets.BITNAMI_BOT_TOKEN }}
|
|
- name: Execute readme-generator-for-helm
|
|
env:
|
|
DIFF_URL: "${{github.event.pull_request.diff_url}}"
|
|
TEMP_FILE: "${{runner.temp}}/pr-${{github.event.number}}.diff"
|
|
run: |
|
|
# This request doesn't consume API calls.
|
|
curl -Lkso $TEMP_FILE $DIFF_URL
|
|
files_changed="$(sed -nr 's/[\-\+]{3} [ab]\/(.*)/\1/p' $TEMP_FILE | sort | uniq)"
|
|
# Adding || true to avoid "Process exited with code 1" errors
|
|
charts_dirs_changed="$(echo "$files_changed" | xargs dirname | grep -o "bitnami/[^/]*" | sort | uniq || true)"
|
|
for chart in ${charts_dirs_changed}; do
|
|
echo "Updating README.md for ${chart}"
|
|
readme-generator --values "charts/${chart}/values.yaml" --readme "charts/${chart}/README.md" --schema "/tmp/schema.json"
|
|
done
|
|
- name: Push changes
|
|
run: |
|
|
# Push all the changes
|
|
cd charts
|
|
if git status -s | grep bitnami; then
|
|
git config user.name "Bitnami Containers"
|
|
git config user.email "bitnami-bot@vmware.com"
|
|
git add . && git commit -am "Update README.md with readme-generator-for-helm" --signoff && git push
|
|
fi
|