Skip to content

chore: log L1 trace errors once in debug #2616

chore: log L1 trace errors once in debug

chore: log L1 trace errors once in debug #2616

name: Auto Rebase PR
on:
pull_request:
types: [labeled]
jobs:
auto-rebase:
if: contains(github.event.pull_request.labels.*.name, 'auto-rebase-pr')
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
fetch-depth: 0
token: ${{ secrets.AZTEC_BOT_GITHUB_TOKEN }}
ref: ${{ github.event.pull_request.head.ref }}
- name: Authenticate with GitHub CLI
run: |
echo "${{ secrets.AZTEC_BOT_GITHUB_TOKEN }}" | gh auth login --with-token
- name: Run auto rebase script
id: rebase
env:
GH_TOKEN: ${{ secrets.AZTEC_BOT_GITHUB_TOKEN }}
run: |
set -x
pr_head_ref=${{ github.event.pull_request.head.ref }}
pr_base_ref=${{ github.event.pull_request.base.ref }}
# ensure we have up to date head/base
git fetch origin "$pr_base_ref" "$pr_head_ref"
# Be sure to run the auto rebase script such that we don't write to it while it's being read.
cp ./scripts/auto_rebase_pr.sh .github/temp-script.sh
bash .github/temp-script.sh "$pr_head_ref" "$pr_base_ref"
rebase_sha=$(git rev-parse HEAD)
git switch --force-create "$pr_head_ref" "origin/$pr_base_ref"
git reset --hard "$rebase_sha"
git push origin "$pr_head_ref" --force-with-lease
- name: Post failure comment
if: failure() || steps.rebase.outcome == 'failure'
run: |
gh pr comment ${{ github.event.pull_request.number }} --body "## Auto-rebase failed ❌. [Github run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})"
- name: Remove label
if: always()
run: |
gh pr edit ${{ github.event.pull_request.number }} \
--remove-label "auto-rebase-pr"