zed-pr-merged #1710
This file contains 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: Advance Zed | |
concurrency: ${{ github.workflow }} | |
# This type must match the event type from Zed. | |
# https://help.github.com/en/actions/reference/events-that-trigger-workflows#external-events-repository_dispatch | |
# These events only trigger on the GitHub default branch. | |
on: | |
repository_dispatch: | |
types: [zed-pr-merged] | |
workflow_dispatch: | |
inputs: | |
zed_ref: | |
required: true | |
type: string | |
env: | |
branch: advance-zed-${{ github.event.client_payload.merge_commit_sha || inputs.zed_ref }} | |
zed_ref: ${{ github.event.client_payload.merge_commit_sha || inputs.zed_ref }} | |
jobs: | |
create-branch: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
# ref defaults to github.sha, which is fixed at the time a workflow is | |
# triggered. Using github.ref ensures that a run that waits for the | |
# concurrency group will see any commits pushed by the runs that | |
# caused it to wait, reducing push failures down below. | |
ref: ${{ github.ref }} | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
- run: go get github.com/brimdata/zed@${{ env.zed_ref }} | |
- run: go mod tidy | |
- run: git -c user.name='Brim Automation' -c [email protected] commit -a -m 'upgrade Zed to ${{ env.zed_ref }}' | |
- run: git push origin HEAD:${{ env.branch }} | |
ci: | |
needs: create-branch | |
uses: ./.github/workflows/ci.yaml | |
with: | |
# This value must match env.branch. (Can't use that here because the env | |
# context isn't available). | |
ref: advance-zed-${{ github.event.client_payload.merge_commit_sha || inputs.zed_ref }} | |
push: | |
needs: ci | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
# Need an admin token to bypass branch protection on main. | |
token: ${{ secrets.PAT_TOKEN }} | |
- run: git fetch --depth=2 origin ${{ env.branch }} | |
- run: git -c user.name='Brim Automation' -c [email protected] cherry-pick FETCH_HEAD | |
- run: git push | |
- run: git push --delete origin ${{ env.branch }} |