ci: Lock only if it was not locked before

This commit is contained in:
bbhtt
2024-11-02 07:29:42 +05:30
parent c95ce4b732
commit ef5769ecd3
+3 -1
View File
@@ -17,7 +17,9 @@ jobs:
cmd=$(gh pr list --repo "$REPO" -L 100 --state closed --json number,updatedAt|jq '[.[] | select(.updatedAt >= (now - (7 * 24 * 60 * 60) | todate))] | sort_by(.updatedAt) | .[] | {number: .number, updatedAt: .updatedAt}'| jq '.number')
for num in $cmd; do
gh pr lock --repo "$REPO" --reason "resolved" "$num"
if [ "$(gh api repos/$REPO/issues/$num --jq '.active_lock_reason'| wc -c)" -le 1 ]; then
gh pr lock --repo "$REPO" --reason "resolved" "$num"
fi
done
env:
GITHUB_TOKEN: ${{ secrets.FLATHUBBOT_TOKEN }}