Skip to content

Commit 8924dc9

Browse files
committed
build: add workflow to merge PRs with Ready to Merge label
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 9836337 commit 8924dc9

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
#/
2+
# @license Apache-2.0
3+
#
4+
# Copyright (c) 2025 The Stdlib Authors.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#/
18+
19+
# Workflow name:
20+
name: merge_ready_prs
21+
22+
# Workflow triggers:
23+
on:
24+
workflow_dispatch:
25+
26+
# Workflow jobs:
27+
jobs:
28+
29+
# Define a job for merging PRs with Ready to Merge label:
30+
merge:
31+
32+
# Define a display name:
33+
name: 'Merge Ready PRs'
34+
35+
# Define the type of virtual host machine:
36+
runs-on: ubuntu-latest
37+
38+
# Define the job's steps:
39+
steps:
40+
41+
# Checkout the repository:
42+
- name: 'Checkout repository'
43+
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
44+
45+
# Merge PRs with Ready to Merge label:
46+
- name: 'Merge PRs'
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.STDLIB_BOT_GITHUB_TOKEN }}
49+
run: |
50+
# Get all PRs with the "Ready to Merge" label:
51+
prs=$(gh pr list --label "Ready to Merge" --json number --jq '.[].number')
52+
53+
if [ -z "$prs" ]; then
54+
echo "No PRs found with 'Ready to Merge' label."
55+
exit 0
56+
fi
57+
58+
echo "Found PRs to merge: $prs"
59+
echo ""
60+
61+
# Track results:
62+
succeeded=""
63+
failed=""
64+
65+
# Merge each PR:
66+
for pr in $prs; do
67+
echo "Merging PR #$pr..."
68+
if ./.github/workflows/scripts/merge_pr "$pr"; then
69+
echo "Successfully merged PR #$pr"
70+
succeeded="$succeeded $pr"
71+
else
72+
echo "Failed to merge PR #$pr"
73+
failed="$failed $pr"
74+
fi
75+
echo ""
76+
done
77+
78+
# Print summary:
79+
echo "================================"
80+
echo "Summary:"
81+
if [ -n "$succeeded" ]; then
82+
echo "Merged:$succeeded"
83+
fi
84+
if [ -n "$failed" ]; then
85+
echo "Failed:$failed"
86+
exit 1
87+
fi

0 commit comments

Comments
 (0)