Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: close conflicting prs created by aqua-registry app #31680

Merged
merged 1 commit into from
Feb 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
ci: close conflicting prs created by aqua-registry app
  • Loading branch information
suzuki-shunsuke committed Feb 3, 2025
commit 48206f70cb305626f963e7b655ca0a122e3896d3
39 changes: 39 additions & 0 deletions .github/workflows/close-conflicting-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
name: Close conflicting PRs created by aquaproj-aqua-registry
on:
workflow_dispatch: {}
schedule:
- cron: "0 */1 * * *" # Hourly

jobs:
rerun:
runs-on: ubuntu-24.04
timeout-minutes: 15
permissions:
pull-requests: write # To close pull requests
steps:
- run: |
set -eu

info() {
echo "[INFO] $*" >&2
}

bot=app/aquaproj-aqua-registry

info "searching pull requests"
numbers=$(gh -R "$GITHUB_REPOSITORY" pr list \
--json number,mergeable \
-S "author:$bot is:open" \
-L 100 \
-q '.[] | select(.mergeable == "CONFLICTING") | .number')

workflow_run_url=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID

for number in $numbers; do
info "closing a pull request #$number"
gh -R "$GITHUB_REPOSITORY" pr close -d \
-c "[Workflow]($workflow_run_url) Close this pull request because this is created by app/aquaproj-aqua-registry and it has conflicts"
done
env:
GITHUB_TOKEN: ${{github.token}}