Repository navigation
fix(ci): seed the adhoc release repo so releases can be tagged - #12375
Conversation
gh repo create leaves the repo empty, and publishing a release creates a git tag that needs a commit to point at. The adhoc build got all the way through notarization and upload before failing on "Repository is empty". Co-authored-by: Orca <[email protected]>
📝 WalkthroughWalkthroughThe setup script now creates new adhoc release repositories with a README commit. It checks both new and existing repositories for at least one commit. It stops with an actionable error when a repository is empty. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 2c7bfccf-2806-4825-8c98-780d0981ae37
📒 Files selected for processing (1)
config/scripts/setup-adhoc-release-repo.sh
| # Also checked outside the create branch: a repo made before --add-readme is here. | ||
| if ! gh api "repos/$ADHOC_REPO/commits" --jq 'length' >/dev/null 2>&1; then | ||
| fail "$ADHOC_REPO has no commits — releases cannot be tagged. Add any file to it first." | ||
| fi |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
: "${ADHOC_REPO:?Set ADHOC_REPO to OWNER/REPO}"
for attempt in 1 2 3 4 5; do
set +e
response="$(gh api "repos/$ADHOC_REPO/commits?per_page=1" \
--include \
--jq 'length' 2>&1)"
exit_code=$?
set -e
printf 'attempt=%s exit=%s\n%s\n' "$attempt" "$exit_code" "$response"
if [ "$exit_code" -eq 0 ]; then
exit 0
fi
sleep "$attempt"
done
exit 1Repository: stablyai/orca
Length of output: 206
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
echo "Locate file:"
git ls-files 'config/scripts/setup-adhoc-release-repo.sh' || true
if [ -f config/scripts/setup-adhoc-release-repo.sh ]; then
echo "Relevant lines:"
sed -n '45,65p' config/scripts/setup-adhoc-release-repo.sh | cat -n
echo "All gh api exits:"
rg -n "gh api|fail \\(" config/scripts/setup-adhoc-release-repo.sh
fi
echo "Check gh availability/version:"
if command -v gh >/dev/null 2>&1; then
gh --version | sed -n '1,5p'
else
echo "gh not installed"
fiRepository: stablyai/orca
Length of output: 1732
🌐 Web query:
GitHub REST API list commits empty repository 409 Conflict
💡 Result:
When you attempt to list commits using the GitHub REST API (GET /repos/{owner}/{repo}/commits) on an empty repository, the API returns a 409 Conflict status code with the error message "Git Repository is empty." [1][2][3]. This behavior occurs because the repository lacks the necessary Git data (such as a commit history) required to return a list of commits [2]. The 409 Conflict status is the standard response from the GitHub API when interacting with repository content in a state that does not support the requested operation, such as an empty or uninitialized repository [2]. To resolve this and begin managing the repository via the API, you must first initialize the repository by adding content. You can do this by using the "Create or update file contents" endpoint (PUT /repos/{owner}/{repo}/contents/{path}) to commit an initial file to the repository [2][4]. Once the repository has at least one commit, subsequent requests to the list commits endpoint will return a 200 OK status with the commit history.
Citations:
- 1: [Schema Inaccuracy]
GET /repos/{owner}/{repo}/commitscan respond with 409 if repository is empty github/rest-api-description#385 - 2: https://docs.github.com/en/rest/guides/using-the-rest-api-to-interact-with-your-git-database
- 3: Error occurs when fetching commit data from empty repository amzn/oss-dashboard#102
- 4: https://github.com/github/docs/blob/main/content/rest/guides/using-the-rest-api-to-interact-with-your-git-database.md
Use status-aware availability retries for the API check.
This non-zero gh api condition reports every API failure as an empty repository. Authentication, permission, rate-limit, network, and transient 409 failures receive the same error message. Capture the response/status, use bounded retries for repository availability, and keep a separate error path for API failures.
…yai#12375) gh repo create leaves the repo empty, and publishing a release creates a git tag that needs a commit to point at. The adhoc build got all the way through notarization and upload before failing on "Repository is empty". Co-authored-by: Orca <[email protected]>
What
config/scripts/setup-adhoc-release-repo.shcreatedstablyai/orca-adhocwithgh repo createand no initial commit. Adds--add-readme, plus a precheck that fails immediately if the repo has no commits.Why
Publishing a GitHub release creates a git tag, and a tag needs a commit to point at. An empty repo accepts the draft — drafts carry no tag — so the adhoc pipeline built, signed, notarized, uploaded all nine artifacts, verified the update manifest, and only then failed:
~25 minutes in, after the notary round trip. The draft-discard step cleaned up correctly, so nothing was stranded, but the whole run was wasted.
The live repo has since been seeded by hand (
ff9ca5b), so this is about the next time someone runs the setup script — a re-provision, or a fourth channel modelled on this one. The precheck exists because a repo created before this change is still empty and the failure only surfaces at the very end.Verification
bash -nclean.v1.4.164-adhoc.20260802094839published with both architectures andlatest-mac.yml.Made with Orca 🐋