UltimateCoderandClaude Opus 5.5 b7cbbe7b7b fix: handle file paths with spaces
xargs split paths on whitespace, so sed failed on files like
'..._Removed MediaType Enum.cs' (exit 123). Pass the file list
NUL-separated and only rewrite files containing {{BUILD_VAR_.
A repo without any placeholder no longer fails on grep's exit 1.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-15 22:03:00 +02:00
2026-10-15 22:03:00 +02:00

replace-build-vars

Composite action for Gitea Actions. Replaces {{BUILD_VAR_*}} placeholders in every text file of the checkout (excluding .git) with build information. It's a plain in-place text replace that works with any language. No inputs.

Usage

steps:
  - uses: actions/checkout@v4
  - uses: https://git.custom-coding.net/templates/replace-build-vars@v1

Step-level uses: must be the absolute URL. Gitea resolves short refs against github.com.

Placeholders

Placeholder Value
{{BUILD_VAR_COMMIT_SHA_SHORT}} first 7 chars of GITHUB_SHA
{{BUILD_VAR_BUILD_DATE}} UTC, ISO 8601: %Y-%m-%dT%H:%M:%SZ
{{BUILD_VAR_REF_LABEL}} pr-<n> for pull requests, otherwise GITHUB_REF_NAME with / → -. This matches the docker-build image tag.
{{BUILD_VAR_GITHUB_SHA}} GITHUB_SHA
{{BUILD_VAR_GITHUB_REF_NAME}} GITHUB_REF_NAME
{{BUILD_VAR_GITHUB_REF_TYPE}} GITHUB_REF_TYPE
{{BUILD_VAR_GITHUB_REPOSITORY}} GITHUB_REPOSITORY
{{BUILD_VAR_GITHUB_REPOSITORY_OWNER}} GITHUB_REPOSITORY_OWNER
{{BUILD_VAR_GITHUB_RUN_ID}} GITHUB_RUN_ID
{{BUILD_VAR_GITHUB_RUN_NUMBER}} GITHUB_RUN_NUMBER
{{BUILD_VAR_GITHUB_RUN_ATTEMPT}} GITHUB_RUN_ATTEMPT
{{BUILD_VAR_GITHUB_RETENTION_DAYS}} GITHUB_RETENTION_DAYS
{{BUILD_VAR_GITHUB_SERVER_URL}} GITHUB_SERVER_URL
{{BUILD_VAR_GITHUB_EVENT_NAME}} GITHUB_EVENT_NAME
{{BUILD_VAR_GITHUB_BASE_REF}} GITHUB_BASE_REF
{{BUILD_VAR_GITHUB_HEAD_REF}} GITHUB_HEAD_REF
{{BUILD_VAR_GITHUB_ACTION_REF}} GITHUB_ACTION_REF
{{BUILD_VAR_GITHUB_ACTION_REPOSITORY}} GITHUB_ACTION_REPOSITORY
{{BUILD_VAR_GITEA_ACTIONS_RUNNER_VERSION}} GITEA_ACTIONS_RUNNER_VERSION

Values are inserted into a sed expression with | as delimiter, so a value that contains | breaks the replace.

Versioning

Only major tags (v1, v2, …). Fixes and new placeholders move the existing tag. Renaming or removing a placeholder, or changing a value's format, needs a new major tag.

History before the move: UltimateCoder/resuable-workflows (actions/replace-build-vars).

S
Description
Composite action: replace {{BUILD_VAR_*}} placeholders with build info
Readme
34 KiB
0 Stars 2 Watchers 0 Forks