mirror of
https://github.com/plcnk/charts.git
synced 2026-04-05 17:22:21 +00:00
116 lines
3.9 KiB
YAML
116 lines
3.9 KiB
YAML
name: Renovate
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- renovate/**
|
|
|
|
env:
|
|
COMMIT_MESSAGE: "chore: Update chart metadata"
|
|
|
|
jobs:
|
|
update-chart-metadata:
|
|
name: Update Chart Metadata
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
AUTHOR_USER: chart-bot
|
|
AUTHOR_EMAIL: 160046936+charts-bot[bot]@users.noreply.github.com
|
|
steps:
|
|
- name: Generate Token
|
|
id: app-token
|
|
uses: actions/create-github-app-token@v1
|
|
with:
|
|
app-id: ${{ secrets.BOT_APP_ID }}
|
|
private-key: ${{ secrets.BOT_APP_PRIVATE_KEY }}
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
token: ${{ steps.app-token.outputs.token }}
|
|
fetch-depth: 0
|
|
|
|
- name: Detect Changes
|
|
uses: dorny/paths-filter@v3
|
|
id: changes
|
|
with:
|
|
list-files: shell
|
|
filters: |
|
|
charts:
|
|
- charts/**
|
|
|
|
- name: Fetch PR
|
|
id: pr
|
|
uses: actions/github-script@v7
|
|
with:
|
|
github-token: ${{ steps.app-token.outputs.token }}
|
|
script: |
|
|
const response = await github.rest.repos.listPullRequestsAssociatedWithCommit({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
commit_sha: context.sha,
|
|
});
|
|
const pr = response.data.shift();
|
|
core.setOutput("title", pr.title);
|
|
core.setOutput("base_ref", pr.base.ref);
|
|
core.setOutput("labels", pr.labels.map((e) => e.name).filter((e) => e));
|
|
|
|
- name: Update changelog
|
|
env:
|
|
TITLE: ${{ steps.pr.outputs.title }}
|
|
CHANGELOG_APPEND: ${{ contains(steps.pr.outputs.labels, 'changelog-append') }}
|
|
BREAKING_CHANGE: ${{ contains(steps.pr.outputs.labels, 'breaking-change') }}
|
|
run: |
|
|
set -eux
|
|
export DESCRIPTION="$(perl -pe 's/^.+?: (.)/\U$1/' <<<"$TITLE")"
|
|
if [[ "$BREAKING_CHANGE" == "true" ]]; then
|
|
DESCRIPTION="BREAKING - $DESCRIPTION"
|
|
fi
|
|
CHANGELOG="$(yq -o json '[{"kind": "changed", "description": strenv(DESCRIPTION)}]')"
|
|
UPDATE_TYPE=replace
|
|
if [[ "$CHANGELOG_APPEND" == "true" ]]; then
|
|
UPDATE_TYPE=append
|
|
fi
|
|
./hack/update-changelog.sh "$UPDATE_TYPE" "$CHANGELOG" ${{ steps.changes.outputs.charts_files }}
|
|
|
|
- name: Set type to patch
|
|
if: contains(steps.pr.outputs.labels, 'patch') || contains(steps.pr.outputs.labels, 'digest')
|
|
run: echo TYPE=patch >>$GITHUB_ENV
|
|
- name: Set type to minor
|
|
if: contains(steps.pr.outputs.labels, 'major') || contains(steps.pr.outputs.labels, 'minor')
|
|
run: echo TYPE=minor >>$GITHUB_ENV
|
|
- name: Update chart version
|
|
if: "!contains(steps.pr.outputs.labels, 'skip-version-bump')"
|
|
run: |
|
|
set -eux
|
|
./hack/update-version.sh "$TYPE" ${{ steps.changes.outputs.charts_files }}
|
|
|
|
- name: Install helm-docs
|
|
uses: gabe565/setup-helm-docs-action@v1
|
|
- name: Generate Helm docs
|
|
run: |
|
|
set -eu
|
|
./hack/gen-helm-docs.sh
|
|
|
|
- name: Check if commit exists
|
|
id: commit_exists
|
|
env:
|
|
BASE_REF: ${{ steps.pr.outputs.base_ref }}
|
|
run: |
|
|
set -eu
|
|
IFS=$'\n\t'
|
|
commits="$(git rev-list --pretty=oneline "origin/$BASE_REF..HEAD" | cut -d' ' -f2-)"
|
|
if grep -F -e "$COMMIT_MESSAGE" <<<"$commits"; then
|
|
echo 'result=true' >>$GITHUB_OUTPUT
|
|
else
|
|
echo 'result=false' >>$GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Commit chart version
|
|
uses: stefanzweifel/git-auto-commit-action@v5
|
|
if: steps.commit_exists.outputs.result == 'false' && !contains(steps.pr.outputs.labels, 'skip-chart-meta')
|
|
with:
|
|
commit_user_name: ${{ env.AUTHOR_USER }}
|
|
commit_user_email: ${{ env.AUTHOR_EMAIL }}
|
|
commit_author: ${{ env.AUTHOR_USER }} <${{ env.AUTHOR_EMAIL }}>
|
|
commit_message: ${{ env.COMMIT_MESSAGE }}
|