mirror of
https://github.com/Drop-OSS/flathub-app-bin.git
synced 2026-07-01 12:43:45 -04:00
pr-check: Auto lock blocked PRs with too many failing builds
This commit is contained in:
@@ -21,7 +21,7 @@ jobs:
|
||||
CUTOFF_DATE="2025-05-25T00:00:00Z"
|
||||
prs_raw=$(gh pr list --base "new-pr" -L 50 --state open --json number,createdAt,updatedAt,isDraft,labels \
|
||||
| jq -r --arg cutoff "$CUTOFF_DATE" '[.
|
||||
[]
|
||||
[]
|
||||
| select(
|
||||
.isDraft == false
|
||||
and .createdAt >= $cutoff
|
||||
@@ -149,6 +149,14 @@ jobs:
|
||||
echo "Nothing to do"
|
||||
start_build
|
||||
fi
|
||||
if [ "$BLOCKED" -eq 1 ] \
|
||||
&& label_exists_any "pr-check-blocked" "blocked" \
|
||||
&& ! comment_exists_any "$BUILD_SUCCESS_COMMENT" \
|
||||
&& [ "$(echo "$PR_COMMENTS" | grep -E -c 'Test build.*failed')" -gt 10 ]; then
|
||||
echo "PR is blocked and too many failing builds. Locking"
|
||||
gh pr comment "$PR_NUM" --body "$LOCKED_COMMENT"
|
||||
gh pr lock "$PR_NUM" || true
|
||||
fi
|
||||
done
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -168,4 +176,9 @@ jobs:
|
||||
request title is `Add $FLATPAK_ID` and that all
|
||||
[checklist items](https://github.com/flathub/flathub/blob/master/.github/pull_request_template.md)
|
||||
in the pull request body are marked as complete.
|
||||
LOCKED_COMMENT: >
|
||||
This pull request is marked as blocked and has too many
|
||||
builds failing. Locking this PR temporarily. Please build
|
||||
it locally following the instructions and push the relevant
|
||||
changes first.
|
||||
REVIEW_COMMENT_PARTIAL: "This pull request is temporarily marked as blocked as some"
|
||||
|
||||
Reference in New Issue
Block a user