ci: automatically update the readme and golden files on PRs #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Chart - Update Golden Files and README" | |
on: | |
pull_request: | |
branches: | |
- main | |
paths: | |
- ".github/workflows/chart-update-readme-and-golden-files.yaml" | |
- "charts/**" | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
chores: | |
name: Update README And Golden Files | |
runs-on: ubuntu-latest | |
steps: | |
# | |
# Checkout. | |
# | |
- name: Set vars | |
run: | | |
echo "CHANGED_CHARTS=$(ct list-changed | tr '\n' ' ')" | tee -a $GITHUB_ENV | |
- name: Generate GitHub token | |
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2 | |
id: generate-github-token | |
with: | |
app_id: ${{ secrets.GH_APP_ID_DISTRO_CI }} | |
private_key: ${{ secrets.GH_APP_PRIVATE_KEY_DISTRO_CI }} | |
- name: Checkout | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
with: | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
ref: ${{ github.event.pull_request.head.ref }} | |
fetch-depth: 0 | |
# | |
# Dependencies. | |
# | |
- name: Install dependencies | |
uses: asdf-vm/actions/install@05e0d2ed97b598bfce82fd30daf324ae0c4570e6 # v3 | |
- name: Install readme-generator-for-helm | |
run: npm install -g @bitnami/readme-generator-for-helm | |
# | |
# Update | |
# | |
- name: Update golden files | |
run: | | |
chartPath="${CHANGED_CHARTS}" \ | |
make go.update-golden-only | |
- name: Run readme generator | |
run: | | |
git fetch origin main:main | |
echo "Updating README.md" | |
chartPath="$(ct list-changed | tr '\n' ' ')" \ | |
make helm.readme-update | |
git diff --exit-code || ( | |
echo "Please ensure to run: make helm.readme-update"; | |
exit 1; | |
) | |
- name: Git pull | |
run: git pull --rebase --autostash . | |
- uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9.1.4 | |
with: | |
author_name: "distro-ci[bot]" | |
author_email: "122795778+distro-ci[bot]@users.noreply.github.com" | |
message: "chore: Update golden files" |