Skip to content

update-contributoor #44

update-contributoor

update-contributoor #44

name: update-contributoor-dependency
on:
repository_dispatch:
types: [update-contributoor]
permissions:
contents: write
pull-requests: write
jobs:
update-pr:
runs-on: ubuntu-latest
outputs:
pr_number: ${{ steps.cpr.outputs.pull-request-number }}
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.PANDA_OPS_BOT_PAT }}
fetch-depth: 0
ref: master
- name: Set up Go
uses: ./.github/workflows/go-setup
- name: Update contributoor dependency
run: |
go get github.com/ethpandaops/contributoor@${{ github.event.client_payload.version }}
go mod tidy
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.PANDA_OPS_BOT_PAT }}
commit-message: "chore: update contributoor to ${{ github.event.client_payload.version }}"
title: "chore: update contributoor to ${{ github.event.client_payload.version }}"
branch: update-contributoor-${{ github.event.client_payload.version }}
delete-branch: true
labels: dependencies
body: |
Updates contributoor to ${{ github.event.client_payload.version }}
This PR was automatically created by the contributoor release workflow.
- name: Enable auto-merge
if: steps.cpr.outputs.pull-request-operation == 'created'
env:
GH_TOKEN: ${{ secrets.PANDA_OPS_BOT_PAT }}
PR_URL: ${{ steps.cpr.outputs.pull-request-url }}
run: |
# Enable auto-merge with merge strategy and require all checks to pass
gh pr merge --auto --merge --delete-branch "$PR_URL"
wait-for-merge:
needs: update-pr
runs-on: ubuntu-latest
if: needs.update-pr.outputs.pr_number
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.PANDA_OPS_BOT_PAT }}
fetch-depth: 0
ref: master
- name: Wait for PR merge
env:
GH_TOKEN: ${{ secrets.PANDA_OPS_BOT_PAT }}
PR_NUMBER: ${{ needs.update-pr.outputs.pr_number }}
run: |
while true; do
STATUS=$(gh pr view $PR_NUMBER --json state,mergeStateStatus -q '[.state, .mergeStateStatus] | join(",")')
echo "PR status: $STATUS"
if [[ "$STATUS" == "MERGED,"* ]]; then
echo "PR was merged successfully"
break
elif [[ "$STATUS" == "CLOSED,"* ]]; then
echo "PR was closed without merging"
exit 1
fi
echo "Waiting for PR to be merged..."
sleep 30
done
create-release:
needs: [wait-for-merge]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.PANDA_OPS_BOT_PAT }}
fetch-depth: 0
ref: master
- name: Create Tag
env:
GITHUB_TOKEN: ${{ secrets.PANDA_OPS_BOT_PAT }}
GH_TOKEN: ${{ secrets.PANDA_OPS_BOT_PAT }}
run: |
git config --global user.email "ethpandaopsbot@ethereum.org"
git config --global user.name "ethpandaopsbot"
VERSION="${{ github.event.client_payload.version }}"
# Check if tag already exists
if git rev-parse "v${VERSION}" >/dev/null 2>&1; then
echo "Tag v${VERSION} already exists"
exit 1
fi
# Pull latest changes
git pull origin master
# Create and push tag - this will trigger release.yml
git tag "${VERSION}"
git push origin "${VERSION}"