Skip to content

Merge Queue

Merge Queue #201

Workflow file for this run

name: Merge Queue
on:
merge_group:
permissions:
id-token: write
contents: read
actions: read
env:
BODY_LIMIT: '1048576000'
jobs:
init:
runs-on: hz-ubuntu-dind
outputs:
is-release: ${{ steps.context.outputs.is-release }}
current-version: ${{ steps.context.outputs.current-version }}
steps:
- id: context
uses: milaboratory/github-ci/actions/context/init@v4
with:
version-canonize: false
branch-versioning: main
check-changesets:
uses: ./.github/workflows/_check-changesets.yaml
secrets: inherit
check-pnpm-consistency:
uses: ./.github/workflows/_check.yaml
secrets: inherit
test:
needs: [init, check-changesets]
uses: ./.github/workflows/_test.yaml
secrets: inherit
monitor-merge-queue:
runs-on: hz-ubuntu-dind
if: always()
needs: [test]
steps:
- name: Check workflow duration
id: check-duration
env:
GH_TOKEN: ${{ github.token }}
DURATION_THRESHOLD_MINUTES: '10'
run: |
RUN_STARTED_AT=$(gh api "/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}" --jq '.run_started_at')
START_EPOCH=$(date -d "${RUN_STARTED_AT}" +%s)
CURRENT_EPOCH=$(date +%s)
DURATION_MINUTES=$(( (CURRENT_EPOCH - START_EPOCH) / 60 ))
echo "Duration: ${DURATION_MINUTES} minutes (threshold: ${DURATION_THRESHOLD_MINUTES})"
if [ "${DURATION_MINUTES}" -gt "${DURATION_THRESHOLD_MINUTES}" ]; then
echo "::warning::Merge queue run took ${DURATION_MINUTES} minutes, exceeding threshold"
echo "alert=true" >> "$GITHUB_OUTPUT"
echo "duration=${DURATION_MINUTES}" >> "$GITHUB_OUTPUT"
else
echo "alert=false" >> "$GITHUB_OUTPUT"
fi
- name: Send slow merge queue alert
if: steps.check-duration.outputs.alert == 'true'
uses: milaboratory/github-ci/actions/notify/slack/send@v4
with:
token: ${{ secrets.SLACK_BOT_TOKEN }}
method: chat.postMessage
payload: |
{
"channel": "${{ secrets.SLACK_PL_SDK_CHANNEL }}",
"text": "Slow Merge Queue: ${{ github.repository }} took ${{ steps.check-duration.outputs.duration }} min (threshold: 10 min)",
"blocks": [
{"type": "header", "text": {"type": "plain_text", "text": "Slow Merge Queue Alert"}},
{"type": "section", "text": {"type": "mrkdwn", "text": "*${{ github.repository }}* merge queue took *${{ steps.check-duration.outputs.duration }} minutes*"}},
{"type": "section", "text": {"type": "mrkdwn", "text": "This may indicate Turbo cache issues or infrastructure problems."}}
]
}