1 parent
90a4f657b6
commit
c4504574b0
1 file changed
+44
@@ -0,0 +1,44 @@
|
|||||||
|
# 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
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
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_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](https://git.custom-coding.net/UltimateCoder/resuable-workflows) (`actions/replace-build-vars`).
|
||||||
Reference in new issue
Block a user