fe86d2a3fa35b8cf4c826e773c67e9bfe04707b8
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_011AgnQS6MHAGGoLNQDvv52d
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).
Entscheidungen
Decisions by the owner of the templates org:
- 2026-10-15: Only major tags (
v1,v2, …), novX.Y.Ztags (see Versioning). - 2026-10-17: All repos in the
templatesorg are public, so consumers' runners can fetch them without credentials. They never contain secrets or internal addresses: secrets come in assecrets:, hosts as inputs.
Description
Composite action: replace {{BUILD_VAR_*}} placeholders with build info
34 KiB
0 Stars
2 Watchers
0 Forks