mirror of
https://github.com/stan220/flathub.git
synced 2026-09-08 16:28:52 +00:00
pr-check: Label draft PRs automatically
This commit is contained in:
@@ -36,10 +36,40 @@ jobs:
|
|||||||
] | .[]')
|
] | .[]')
|
||||||
prs_list=$(printf '%s\n' $prs_raw | head -30 | paste -sd "," -)
|
prs_list=$(printf '%s\n' $prs_raw | head -30 | paste -sd "," -)
|
||||||
echo "PR_LIST=$prs_list" >> "$GITHUB_ENV"
|
echo "PR_LIST=$prs_list" >> "$GITHUB_ENV"
|
||||||
|
draft_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 == true
|
||||||
|
and .createdAt >= $cutoff
|
||||||
|
and .updatedAt >= (now - (2 * 24 * 60 * 60) | todate)
|
||||||
|
and (all(.labels[].name; . != "Stale") or (.labels == []))
|
||||||
|
)
|
||||||
|
| .number
|
||||||
|
] | .[]')
|
||||||
|
draft_prs_list=$(printf '%s\n' $draft_prs_raw | head -30 | paste -sd "," -)
|
||||||
|
echo "DRAFT_PR_LIST=$draft_prs_list" >> "$GITHUB_ENV"
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
GH_REPO: ${{ github.repository }}
|
GH_REPO: ${{ github.repository }}
|
||||||
|
|
||||||
|
- name: Label draft PRs
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
GH_REPO: ${{ github.repository }}
|
||||||
|
run: |
|
||||||
|
IFS=',' read -ra PR_NUMBERS <<< "${{ env.DRAFT_PR_LIST }}"
|
||||||
|
|
||||||
|
if [ ${#PR_NUMBERS[@]} -eq 0 ] || [ -z "${PR_NUMBERS[0]}" ]; then
|
||||||
|
echo "No PRs found, exiting."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
for PR_NUM in "${PR_NUMBERS[@]}"; do
|
||||||
|
echo "Checking PR https://github.com/flathub/flathub/pull/$PR_NUM"
|
||||||
|
gh pr edit "$PR_NUM" --add-label "work-in-progress" || true
|
||||||
|
done
|
||||||
|
|
||||||
- name: Validate PRs
|
- name: Validate PRs
|
||||||
run: |
|
run: |
|
||||||
IFS=',' read -ra PR_NUMBERS <<< "${{ env.PR_LIST }}"
|
IFS=',' read -ra PR_NUMBERS <<< "${{ env.PR_LIST }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user