neiam
/gitgud
Git Gud
public · Issues · Pulls · Labels · Forks · Compare · Actions success · Badges · Packages
⭐
1
Log in to mark this repository.
Resolve the forge URL in CI without depending on the deploy
af8d19b · Gabriel Morell · 2026-09-12 05:08
Message
{commit_body(@commit)}
Files changed
modified
.forgejo/workflows/build.yml
+23
−3
@@ -56,6 +56,29 @@ jobs:
| 56 | 56 | |
| 57 | 57 | - uses: docker/setup-buildx-action@v3 |
| 58 | 58 | |
| 59 | + # `vars.CI_FORGE_URL` is a built-in this forge only began injecting | |
| 60 | + # in the same commit that added this job — so the very run that | |
| 61 | + # builds that commit is dispatched by a server without it, and | |
| 62 | + # every later run has it. Fall back to what the runner already | |
| 63 | + # knows, and say so plainly if neither resolves rather than | |
| 64 | + # handing curl an empty URL. | |
| 65 | + - name: Resolve the forge URL | |
| 66 | + env: | |
| 67 | + CI_FORGE_URL: ${{ vars.CI_FORGE_URL }} | |
| 68 | + run: | | |
| 69 | + set -euo pipefail | |
| 70 | + forge_url=${CI_FORGE_URL:-${GITHUB_SERVER_URL:-}} | |
| 71 | + | |
| 72 | + if [ -z "$forge_url" ]; then | |
| 73 | + echo "No forge URL available." >&2 | |
| 74 | + echo "Set a CI_FORGE_URL variable on this repository or its org," >&2 | |
| 75 | + echo "or upgrade the forge to a build that injects it." >&2 | |
| 76 | + exit 1 | |
| 77 | + fi | |
| 78 | + | |
| 79 | + echo "using forge URL: $forge_url" | |
| 80 | + echo "FORGE_URL=$forge_url" >> "$GITHUB_ENV" | |
| 81 | + | |
| 59 | 82 | # Just the OTP release, no image around it: the `release-export` |
| 60 | 83 | # stage is `FROM scratch`, so this lands the release tree and |
| 61 | 84 | # nothing else in ./release. |
@@ -76,7 +99,6 @@ jobs:
| 76 | 99 | - name: Build the .deb for each suite |
| 77 | 100 | id: deb |
| 78 | 101 | env: |
| 79 | − FORGE_URL: ${{ vars.CI_FORGE_URL }} | |
| 80 | 102 | REPOSITORY: ${{ github.repository }} |
| 81 | 103 | COMMIT: ${{ github.sha }} |
| 82 | 104 | SUITES: trixie forky |
@@ -103,7 +125,6 @@ jobs:
| 103 | 125 | # registry gives (GitGud.Packages.Auth). |
| 104 | 126 | - name: Publish to the apt repository |
| 105 | 127 | env: |
| 106 | − FORGE_URL: ${{ vars.CI_FORGE_URL }} | |
| 107 | 128 | REPOSITORY: ${{ github.repository }} |
| 108 | 129 | TOKEN: ${{ github.token }} |
| 109 | 130 | run: | |
@@ -120,7 +141,6 @@ jobs:
| 120 | 141 | |
| 121 | 142 | - name: How to install it |
| 122 | 143 | env: |
| 123 | − FORGE_URL: ${{ vars.CI_FORGE_URL }} | |
| 124 | 144 | REPOSITORY: ${{ github.repository }} |
| 125 | 145 | OWNER: ${{ github.repository_owner }} |
| 126 | 146 | run: | |
Parents: 278311f