Skip to content

Commit b52ad2a

Browse files
committed
Open draft PRs for pending retirements
And mark as ready once time has passed
1 parent b18129f commit b52ad2a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

scripts/retire.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,9 @@ for login in *; do
7575
# If there is a PR already
7676
prNumber=$(jq .number <<< "$prInfo")
7777
epochCreatedAt=$(date --date="$(jq -r .created_at <<< "$prInfo")" +%s)
78-
if (( epochCreatedAt < cutoffEpoch )); then
79-
log "$login has a retirement PR due, commenting with next steps"
78+
if jq -e .draft <<< "$prInfo" >/dev/null && (( epochCreatedAt < cutoffEpoch )); then
79+
log "$login has a retirement PR due, unmarking PR as draft and commenting with next steps"
80+
effect gh pr ready --repo "$ORG/$MEMBER_REPO" "$prNumber"
8081
{
8182
if (( activityCount > 0 )); then
8283
echo "One month has passed, @$login has been active again:"
@@ -122,7 +123,8 @@ for login in *; do
122123
-f "title=Automatic retirement of @$login" \
123124
-F "body=@-" \
124125
-f "head=$ORG:$branchName" \
125-
-f "base=$mainBranch" >/dev/null
126+
-f "base=$mainBranch" \
127+
-F "draft=true" >/dev/null
126128
)
127129
else
128130
log "$login is active with $activityCount activities"

0 commit comments

Comments
 (0)