From d268ca5eec3152ae404e20a81d54f68173c5b184 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Thu, 26 Feb 2026 21:08:11 -0500 Subject: [PATCH 1/5] Add git-bug identity creation step to sync workflow git-bug requires its own identity (not just git config user.*) before bridge configuration can work. Add `git-bug user new` step. Co-Authored-By: Claude Opus 4.6 --- .github/workflows/sync-git-bug.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/sync-git-bug.yml b/.github/workflows/sync-git-bug.yml index 0de5d61c5..cbe2d02cf 100644 --- a/.github/workflows/sync-git-bug.yml +++ b/.github/workflows/sync-git-bug.yml @@ -38,6 +38,13 @@ jobs: chmod +x /usr/local/bin/git-bug git-bug version + - name: Create git-bug identity + run: | + git-bug user new \ + --name="github-actions" \ + --email="github-actions@users.noreply.github.com" \ + --non-interactive + - name: Configure bridge env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 0f9c519e90b89a4d721734bf4dda1e96a0bae135 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Thu, 26 Feb 2026 21:15:20 -0500 Subject: [PATCH 2/5] Fix git-bug sync: fetch/push identity refs, handle missing identities Bug refs reference identity objects stored under refs/identities/*. Without identity refs, git-bug cache build fails with "identity doesn't exist" on every command. Fix by: - Fetching both refs/bugs/* and refs/identities/* from remote - Detecting missing identity refs and wiping orphaned bug refs so that the pull starts fresh (data is re-pulled from GitHub) - Pushing both ref namespaces so subsequent runs can be incremental Co-Authored-By: Claude Opus 4.6 --- .github/workflows/sync-git-bug.yml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sync-git-bug.yml b/.github/workflows/sync-git-bug.yml index cbe2d02cf..ca34329c4 100644 --- a/.github/workflows/sync-git-bug.yml +++ b/.github/workflows/sync-git-bug.yml @@ -26,10 +26,19 @@ jobs: git config --global user.name "github-actions" git config --global user.email "github-actions@users.noreply.github.com" - - - name: Fetch existing bug refs + - name: Fetch existing git-bug refs run: | + # Fetch both bugs and identities; bug refs are unusable without + # their corresponding identity refs (git-bug cache build fails). git fetch origin 'refs/bugs/*:refs/bugs/*' || true + git fetch origin 'refs/identities/*:refs/identities/*' || true + # If identity refs are missing, wipe fetched bug refs to avoid + # "identity doesn't exist" errors during cache build. + if [ -z "$(git for-each-ref refs/identities/)" ]; then + echo "No identity refs found on remote; wiping bug refs to start fresh" + git for-each-ref --format='%(refname)' refs/bugs/ \ + | xargs -r -n1 git update-ref -d || true + fi - name: Install git-bug run: | @@ -60,6 +69,7 @@ jobs: - name: Pull issues from GitHub run: git-bug bridge pull github - - name: Push bug refs to origin + - name: Push git-bug refs to origin run: | git push origin 'refs/bugs/*:refs/bugs/*' + git push origin 'refs/identities/*:refs/identities/*' From e328214a168cb580405e4f0ef4982694fa5ca64a Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Thu, 26 Feb 2026 21:46:09 -0500 Subject: [PATCH 3/5] Skip forks, use dynamic owner/project in git-bug sync workflow - Add fork guard so scheduled sync doesn't run in forks - Replace hardcoded dandi/dandi-cli with GITHUB_REPOSITORY_OWNER and GITHUB_REPOSITORY shell parameter expansion Co-Authored-By: Claude Opus 4.6 --- .github/workflows/sync-git-bug.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sync-git-bug.yml b/.github/workflows/sync-git-bug.yml index ca34329c4..89398346a 100644 --- a/.github/workflows/sync-git-bug.yml +++ b/.github/workflows/sync-git-bug.yml @@ -12,6 +12,8 @@ permissions: jobs: sync: + # Only run in the upstream repo, not in forks + if: ${{ !github.event.repository.fork }} runs-on: ubuntu-latest steps: - name: Checkout @@ -61,8 +63,8 @@ jobs: git-bug bridge new \ --name=github \ --target=github \ - --owner=dandi \ - --project=dandi-cli \ + --owner="${GITHUB_REPOSITORY_OWNER}" \ + --project="${GITHUB_REPOSITORY#*/}" \ --token="$GH_TOKEN" \ --non-interactive From 38e74944813969737c1ee66f1d553f8a94371f88 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Thu, 26 Feb 2026 21:55:32 -0500 Subject: [PATCH 4/5] Add optional bridge push step to git-bug sync workflow Adds a workflow_dispatch input "push-to-github" (default: false) that enables pushing locally-created bugs to GitHub Issues. Scheduled runs remain pull-only. Co-Authored-By: Claude Opus 4.6 --- .github/workflows/sync-git-bug.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/sync-git-bug.yml b/.github/workflows/sync-git-bug.yml index 89398346a..7ca508899 100644 --- a/.github/workflows/sync-git-bug.yml +++ b/.github/workflows/sync-git-bug.yml @@ -6,6 +6,11 @@ on: # Run hourly at minute 17 (avoid top-of-hour contention) - cron: "17 * * * *" workflow_dispatch: + inputs: + push-to-github: + description: "Push local bugs to GitHub Issues" + type: boolean + default: false permissions: contents: write @@ -68,6 +73,10 @@ jobs: --token="$GH_TOKEN" \ --non-interactive + - name: Push local bugs to GitHub + if: inputs.push-to-github + run: git-bug bridge push github + - name: Pull issues from GitHub run: git-bug bridge pull github From 546d3766050cc5ab0840539c5ddd3ac01d8e4ae6 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Thu, 26 Feb 2026 22:17:12 -0500 Subject: [PATCH 5/5] Remove sync git bug workflow for now altogether We should really test it on some smaller dedicated repo fully first. It seems that there are various aspects which are not yet worked out in my understanding of the situation yet --- .github/workflows/sync-git-bug.yml | 86 ------------------------------ 1 file changed, 86 deletions(-) delete mode 100644 .github/workflows/sync-git-bug.yml diff --git a/.github/workflows/sync-git-bug.yml b/.github/workflows/sync-git-bug.yml deleted file mode 100644 index 7ca508899..000000000 --- a/.github/workflows/sync-git-bug.yml +++ /dev/null @@ -1,86 +0,0 @@ ---- -name: Sync git-bug issues - -on: - schedule: - # Run hourly at minute 17 (avoid top-of-hour contention) - - cron: "17 * * * *" - workflow_dispatch: - inputs: - push-to-github: - description: "Push local bugs to GitHub Issues" - type: boolean - default: false - -permissions: - contents: write - -jobs: - sync: - # Only run in the upstream repo, not in forks - if: ${{ !github.event.repository.fork }} - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - # Fetch git-bug refs so we can push incremental updates - fetch-depth: 0 - - - name: Configure git - run: | - # Required by git-bug to have those set, otherwise would not work! - git config --global user.name "github-actions" - git config --global user.email "github-actions@users.noreply.github.com" - - - name: Fetch existing git-bug refs - run: | - # Fetch both bugs and identities; bug refs are unusable without - # their corresponding identity refs (git-bug cache build fails). - git fetch origin 'refs/bugs/*:refs/bugs/*' || true - git fetch origin 'refs/identities/*:refs/identities/*' || true - # If identity refs are missing, wipe fetched bug refs to avoid - # "identity doesn't exist" errors during cache build. - if [ -z "$(git for-each-ref refs/identities/)" ]; then - echo "No identity refs found on remote; wiping bug refs to start fresh" - git for-each-ref --format='%(refname)' refs/bugs/ \ - | xargs -r -n1 git update-ref -d || true - fi - - - name: Install git-bug - run: | - curl -sL -o /usr/local/bin/git-bug \ - https://github.com/git-bug/git-bug/releases/download/v0.10.1/git-bug_linux_amd64 - chmod +x /usr/local/bin/git-bug - git-bug version - - - name: Create git-bug identity - run: | - git-bug user new \ - --name="github-actions" \ - --email="github-actions@users.noreply.github.com" \ - --non-interactive - - - name: Configure bridge - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - git-bug bridge new \ - --name=github \ - --target=github \ - --owner="${GITHUB_REPOSITORY_OWNER}" \ - --project="${GITHUB_REPOSITORY#*/}" \ - --token="$GH_TOKEN" \ - --non-interactive - - - name: Push local bugs to GitHub - if: inputs.push-to-github - run: git-bug bridge push github - - - name: Pull issues from GitHub - run: git-bug bridge pull github - - - name: Push git-bug refs to origin - run: | - git push origin 'refs/bugs/*:refs/bugs/*' - git push origin 'refs/identities/*:refs/identities/*'