blob: 8da0dc28f23c088d7136b9a3faf53a0f6fef840b [file] [log] [blame]
# This is a copy of queue-main.yml, but with a different branch pattern.
# It does not push the result anywhere or notify Discord; it logs instead.
# It is meant for people changing how the commit queue works:
# You can hack on the workflows, push to queue-dev-$USER, and iterate.
# Please keep this file in sync with queue-main.yml.
name: Dev Commit Queue
on:
push:
branches:
- "queue-dev-*"
permissions: read-all
jobs:
formatting:
uses: ./.github/workflows/formatting.yml
permissions:
contents: write
with:
auto_fix: true
go-test:
needs: [formatting]
uses: ./.github/workflows/go_test.yml
permissions: read-all
with:
ref: ${{ needs.formatting.outputs.commit_sha }}
ui-test:
needs: [formatting]
uses: ./.github/workflows/webui_test.yml
permissions: read-all
with:
ref: ${{ needs.formatting.outputs.commit_sha }}
push-to-main:
runs-on: ubuntu-latest
needs: [go-test, ui-test, formatting]
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Push to main
id: push
run: |
COMMIT_TO_PUSH="HEAD"
if [[ "${{ needs.formatting.outputs.commit_sha }}" != "" ]]; then
echo "Using formatted commit: ${{ needs.formatting.outputs.commit_sha }}"
COMMIT_TO_PUSH="${{ needs.formatting.outputs.commit_sha }}"
fi
# Get the actual commit SHA that we're pushing
COMMIT_SHA=$(git rev-parse "${COMMIT_TO_PUSH}")
echo "commit_sha=${COMMIT_SHA}" >> $GITHUB_OUTPUT
# Ensure we have the latest main branch reference
git fetch origin main
# Get the list of commits that would be pushed (in chronological order)
# Use FETCH_HEAD as the base to avoid rewriting local main reference
COMMITS_TO_NOTIFY=$(git log FETCH_HEAD.."${COMMIT_TO_PUSH}" --reverse --format="%H" | tr '\n' ' ')
echo "commits_to_notify=${COMMITS_TO_NOTIFY}" >> $GITHUB_OUTPUT
echo "Commits that would be pushed and notified: ${COMMITS_TO_NOTIFY}"
echo "Would push to main: ${COMMIT_TO_PUSH}"
env:
GITHUB_TOKEN: ${{ github.token }}