fix: add local mempool fallback when Petri relay fails #505
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Preserve Branch-Specific Beads Files | |
| on: | |
| push: | |
| branches: ["**"] | |
| jobs: | |
| preserve-beads: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 2 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Check if this was a merge commit | |
| id: check_merge | |
| run: | | |
| if git log -1 --pretty=format:"%P" | grep -q " "; then | |
| echo "is_merge=true" >> $GITHUB_OUTPUT | |
| echo "✅ Detected merge commit" | |
| else | |
| echo "is_merge=false" >> $GITHUB_OUTPUT | |
| exit 0 | |
| fi | |
| - name: Check for .beads changes in merge | |
| if: steps.check_merge.outputs.is_merge == 'true' | |
| id: check_beads | |
| run: | | |
| if git log -1 --name-only | grep -qE "^\.beads/(issues\.jsonl|deletions\.jsonl|metadata\.json)$"; then | |
| echo "beads_changed=true" >> $GITHUB_OUTPUT | |
| echo "🚨 .beads files were modified in merge - will revert!" | |
| else | |
| echo "beads_changed=false" >> $GITHUB_OUTPUT | |
| exit 0 | |
| fi | |
| - name: Revert .beads to pre-merge state | |
| if: steps.check_merge.outputs.is_merge == 'true' && steps.check_beads.outputs.beads_changed == 'true' | |
| run: | | |
| CURRENT_BRANCH=$(git branch --show-current) | |
| echo "🔄 Reverting .beads/ issue tracking files to pre-merge state on $CURRENT_BRANCH" | |
| # Get the first parent (target branch before merge) | |
| MERGE_BASE=$(git log -1 --pretty=format:"%P" | cut -d' ' -f1) | |
| # Restore specific .beads files from the target branch's state before merge | |
| git checkout $MERGE_BASE -- .beads/issues.jsonl 2>/dev/null || echo "No issues.jsonl in base commit" | |
| git checkout $MERGE_BASE -- .beads/deletions.jsonl 2>/dev/null || echo "No deletions.jsonl in base commit" | |
| git checkout $MERGE_BASE -- .beads/metadata.json 2>/dev/null || echo "No metadata.json in base commit" | |
| # Configure git | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| # Commit the reversion | |
| if git diff --staged --quiet; then | |
| git add .beads/issues.jsonl .beads/deletions.jsonl .beads/metadata.json 2>/dev/null || true | |
| fi | |
| if ! git diff --cached --quiet; then | |
| git commit -m "🔒 Preserve branch-specific .beads issue tracking files | |
| Reverted .beads/ changes from merge to keep $CURRENT_BRANCH version intact. | |
| [skip ci]" | |
| git push origin $CURRENT_BRANCH | |
| echo "✅ Successfully preserved $CURRENT_BRANCH .beads files" | |
| else | |
| echo "ℹ️ No changes to revert" | |
| fi |