blob: 5f532a4d359484c4b7a14444671af38247a04f8f [file] [log] [blame]
Earl Lee2e463fb2025-04-17 11:22:22 -07001# Simplified Commit Queue
2#
3# (Force) push to "queue-main-$USER" a potential change, and
4# this job will push it main if it passes pre-commit and tests,
5# which will run in parallel. The push may fail if the commit
6# cannot be pushed cleanly because it needs to be rebased, which
7# will happen especially if another developer pushes a change at
8# roughly the same time.
9
10name: Main Branch Commit Queue
11on:
12 push:
13 branches:
Josh Bleecher Snyderbd6c1682025-04-25 12:04:07 -070014 - "queue-main-*"
Earl Lee2e463fb2025-04-17 11:22:22 -070015
16permissions: read-all
17
18jobs:
Josh Bleecher Snyderbd6c1682025-04-25 12:04:07 -070019 formatting:
20 uses: ./.github/workflows/formatting.yml
Josh Bleecher Snyderae772262025-04-25 20:02:22 +000021 permissions:
22 contents: write
Josh Bleecher Snyderbd6c1682025-04-25 12:04:07 -070023 with:
24 auto_fix: true
25
Philip Zeyliger4de80d22025-04-23 12:33:31 -070026 go-test:
Josh Bleecher Snyderbd6c1682025-04-25 12:04:07 -070027 needs: [formatting]
Earl Lee2e463fb2025-04-17 11:22:22 -070028 uses: ./.github/workflows/go_test.yml
29 permissions: read-all
30
Philip Zeyliger4de80d22025-04-23 12:33:31 -070031 ui-test:
Josh Bleecher Snyderbd6c1682025-04-25 12:04:07 -070032 needs: [formatting]
Philip Zeyliger4de80d22025-04-23 12:33:31 -070033 uses: ./.github/workflows/webui_test.yml
34 permissions: read-all
35
Earl Lee2e463fb2025-04-17 11:22:22 -070036 push-to-main:
37 runs-on: ubuntu-latest
Josh Bleecher Snyderc3391a92025-04-25 21:03:33 +000038 needs: [go-test, ui-test, formatting]
Earl Lee2e463fb2025-04-17 11:22:22 -070039 permissions:
40 contents: write
41 steps:
42 - uses: actions/checkout@v4
43 with:
44 fetch-depth: 0
45
46 - name: Push to main
47 run: |
48 git config --global user.name "GitHub Actions Bot"
49 git config --global user.email "actions@github.com"
Josh Bleecher Snyderc3391a92025-04-25 21:03:33 +000050
Josh Bleecher Snydereda2a8c2025-04-25 21:24:11 +000051 # Use the formatted commit SHA if available, otherwise use HEAD
52 COMMIT_TO_PUSH="HEAD"
Josh Bleecher Snyderc3391a92025-04-25 21:03:33 +000053 if [[ "${{ needs.formatting.outputs.commit_sha }}" != "" ]]; then
54 echo "Using formatted commit: ${{ needs.formatting.outputs.commit_sha }}"
Josh Bleecher Snydereda2a8c2025-04-25 21:24:11 +000055 COMMIT_TO_PUSH="${{ needs.formatting.outputs.commit_sha }}"
Josh Bleecher Snyderc3391a92025-04-25 21:03:33 +000056 fi
57
Josh Bleecher Snydereda2a8c2025-04-25 21:24:11 +000058 git push https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/boldsoftware/sketch.git "${COMMIT_TO_PUSH}":main
Josh Bleecher Snyderddc81422025-04-25 19:47:05 +000059 env:
60 GITHUB_TOKEN: ${{ github.token }}