Skip to content

fix(deps): update all non-major dependencies #113

fix(deps): update all non-major dependencies

fix(deps): update all non-major dependencies #113

name: reset Chart.yaml changelog annotations
on:
release:
types:
# If you want a workflow to run when stable and pre-releases publish, subscribe to published instead of released and prereleased.
# <https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#release>
- published
pull_request:
branches:
- master
permissions: read-all
jobs:
reset-commit-and-push:
name: reset changelog annotations, commit, and push
runs-on: ubuntu-22.04
container: ghcr.io/chgl/kube-powertools:v2.2.7@sha256:10278eaefa090a009ad2b08b2147f2743ec3350be1e0a23a9b29b00430e2352b
permissions:
contents: write
steps:
- name: Add workspace as safe directory
run: |
git config --global --add safe.directory /__w/recruit/recruit
- name: Checkout
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
with:
fetch-depth: 0
ref: ${{ github.head_ref }}
# currently defaults to just the one chart, "recruit", needs to be updated if
# more charts are added in the future. See <https://github.com/chgl/kube-powertools/blob/master/scripts/generate-chart-changelog.sh>
# for an example script iterating over multiple charts and changelog annotations.
- name: reset Chart.yaml changelog annotations
run: |
# it's most likely impossible to do this in a single yq invocation, as 'annotations["artifacthub.io/changes"]' is
# a string and not an actual yaml array. So we first extract this string, read it back into yq which causes it
# to be parsed as a yaml array which can be indexed to get the first entry back.
# by convention, we assume the first changelog entry describes the version bump.
FIRST_CHANGELOG_ENTRY=$(yq '.annotations["artifacthub.io/changes"]' charts/recruit/Chart.yaml | yq '[.0]')
export FIRST_CHANGELOG_ENTRY
# FIRST_CHANGELOG_ENTRY is a string that looks like a yaml array with a single entry.
# use it to replace the entire changelog annotation with a single entry.
yq -i '.annotations["artifacthub.io/changes"] |= strenv(FIRST_CHANGELOG_ENTRY)' charts/recruit/Chart.yaml
- uses: EndBug/add-and-commit@1bad3abcf0d6ec49a5857d124b0bfb52dc7bb081 # v9.1.3
# run everything above in PRs to make sure it works, but only actually commit it on releases
if: ${{ github.event_name != 'pull_request' }}
with:
add: "charts/"
message: "chore(helm): reset Chart.yaml changelog annotations"
push: origin HEAD:${{ github.head_ref }}