Skip to content

chore: trek gedeelde config en workflow-commentaar gelijk met de rest van de organisatie #10

chore: trek gedeelde config en workflow-commentaar gelijk met de rest van de organisatie

chore: trek gedeelde config en workflow-commentaar gelijk met de rest van de organisatie #10

# Copyright (C) 2026 Sten Tijhuis
# SPDX-License-Identifier: MIT
name: Update tool SHA256 checksums
# Renovate bumpt de vastgezette toolversies maar kan geen checksum berekenen,
# dus op eigen kracht landt elke bump met de hash van de vorige release er nog
# in, en stopt de build op "computed checksum did NOT match". Dit herberekent
# de hashes op Renovates pull requests en commit ze terug op de branch.
#
# Renovate moet die commits leren negeren, anders ziet hij de branch als door
# iemand anders gewijzigd en onderhoudt hij de pull request niet meer. Dat is
# de gitIgnoredAuthors-regel in renovate.json.
on:
pull_request:
types: [opened, synchronize, reopened]
branches: [main, development]
paths:
- '.github/workflows/config-validation.yml'
- '.github/workflows/pr-checks.yml'
- '.github/scripts/update-tool-checksums.sh'
permissions: {}
jobs:
update-checksums:
name: Recalculate SHA256 checksums
runs-on: ubuntu-latest
# Alleen Renovates eigen branches. Dit op een pull request van een mens
# draaien betekent commits pushen naar een branch waar iemand op dat moment
# aan werkt.
#
# De auteur van de pull request, niet github.actor. actor is degene die het
# meest recente event veroorzaakte, en dat is bij een synchronize degene die
# als laatste pushte; dat vergelijken met een botnaam is een controle die
# zizmor terecht spoofbaar noemt. De auteur ligt vast zodra de pull request
# geopend wordt en is niet naar een ander account te zetten.
#
# Also require the head repo to be this repo, not a fork. This job checks
# out github.head_ref and runs a script from it with a write token, so a
# PR from a fork naming its branch renovate/* would otherwise get its
# attacker-controlled script executed with push access.
if: >-
startsWith(github.head_ref, 'renovate/') &&
github.event.pull_request.user.login == 'renovate[bot]' &&
github.event.pull_request.head.repo.full_name == github.repository
permissions:
contents: write
steps:
# persist-credentials: false, ook al pusht deze job. Anders staat het
# token de hele job in .git/config, ook terwijl het script hieronder
# release-tarballs van internet haalt. De push-stap krijgt het token in
# plaats daarvan expliciet mee, voor precies één commando.
# Pinned to the exact commit the pull_request event fired for, not the
# mutable branch name. head_ref is a moving target: a push to the
# renovate/* branch between the job's "if:" check above and this step
# would check out commits that check never evaluated. head.sha is fixed
# in the event payload, so it can't move underneath the job.
- name: Check out the pull request branch
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.event.pull_request.head.sha }}
persist-credentials: false
# Het script controleert elke download tegen de checksum die het project
# naast de release publiceert voordat er iets wordt weggeschreven, dus een
# hash landt hier alleen als upstream er ook voor instaat.
- name: Recalculate and apply checksums
run: .github/scripts/update-tool-checksums.sh --apply
- name: Commit updated checksums
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: ${{ github.head_ref }}
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .github/workflows/config-validation.yml .github/workflows/pr-checks.yml
if git diff --staged --quiet; then
echo "Checksums are already up to date, nothing to commit."
else
git commit -m "chore: update tool SHA256 checksums"
git push "https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" \
"HEAD:refs/heads/${BRANCH}"
fi