From ba1bd9f3d595209022534e66919c10ef49e42e42 Mon Sep 17 00:00:00 2001 From: Dmytro Soroka Date: Mon, 13 Jul 2026 19:15:29 +0200 Subject: [PATCH] fix: support multiple version files in one Record version commit version-file now accepts newline-separated paths; all files are written and committed together, so callers updating several markers (e.g. VERSION plus an installed version.txt) no longer produce duplicate 'Record version' commits. Single-path callers are unaffected. Verified: actionlint 1.7.12 clean; write/commit logic simulated in a temp repo for multi-file, single-file, and idempotent-rerun cases. Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/workflow-update-version-file.yml | 14 ++++++++++---- README.md | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/workflow-update-version-file.yml b/.github/workflows/workflow-update-version-file.yml index dc2a081..2440da8 100644 --- a/.github/workflows/workflow-update-version-file.yml +++ b/.github/workflows/workflow-update-version-file.yml @@ -9,7 +9,7 @@ on: default: master type: string version-file: - description: Path to the version file to overwrite + description: Path to the version file to overwrite; pass multiple paths one per line to update them in a single commit required: false default: public/version.txt type: string @@ -53,8 +53,11 @@ jobs: echo "next-tag input is required" >&2 exit 1 fi - mkdir -p "$(dirname "$VERSION_FILE")" - printf '%s\n' "$NEXT_TAG" > "$VERSION_FILE" + while IFS= read -r version_file; do + [ -z "$version_file" ] && continue + mkdir -p "$(dirname "$version_file")" + printf '%s\n' "$NEXT_TAG" > "$version_file" + done <<< "$VERSION_FILE" echo "new_tag=${NEXT_TAG}" >> "$GITHUB_OUTPUT" - name: Commit version marker @@ -65,7 +68,10 @@ jobs: set -euo pipefail git config --local user.name "github-actions[bot]" git config --local user.email "github-actions[bot]@users.noreply.github.com" - git add "$VERSION_FILE" + while IFS= read -r version_file; do + [ -z "$version_file" ] && continue + git add "$version_file" + done <<< "$VERSION_FILE" if git diff --cached --quiet; then echo "Version file already up to date." exit 0 diff --git a/README.md b/README.md index 48538eb..b69fa48 100644 --- a/README.md +++ b/README.md @@ -125,7 +125,7 @@ Writes the provided tag into a version file on a target branch and pushes the co **Inputs** - `target-branch` (default `master`): branch to check out before writing the version file. -- `version-file` (default `public/version.txt`): path to overwrite with the new tag. +- `version-file` (default `public/version.txt`): path to overwrite with the new tag; pass multiple paths one per line to update them all in a single commit. - `next-tag` (required): tag value to write. **Outputs**