Skip to content

Merge Queue Cleanup #911

Merge Queue Cleanup

Merge Queue Cleanup #911

# Copyright (c) ByteDance Ltd. and/or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Merge Queue Cleanup
on:
schedule:
- cron: '*/5 * * * *'
workflow_dispatch:
inputs:
mode:
description: Report stale runs or cancel them
required: true
type: choice
default: report
options:
- report
- cancel
concurrency:
group: merge-queue-cleanup
cancel-in-progress: false
permissions:
actions: write
contents: read
jobs:
cleanup:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Reconcile stale merge-group runs
env:
GITHUB_TOKEN: ${{ github.token }}
# Scheduled cleanup is report-only until the repository variable is
# explicitly changed to "cancel" after observing dry-run results.
CLEANUP_MODE: >-
${{ github.event_name == 'schedule' &&
(vars.MERGE_QUEUE_CLEANUP_MODE || 'report') || inputs.mode }}
run: |
python3 .github/scripts/merge_queue_ci.py cleanup \
--base-branch main \
--grace-seconds 600 \
--mode "${CLEANUP_MODE}"