Skip to content

Commit 6b74c1b

Browse files
Update stale-bot.yml to improve PR branch listing by using closed state and pagination for better accuracy
1 parent e5d1420 commit 6b74c1b

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

.github/workflows/stale-bot.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
run: |
3434
echo "Branch Name,Last Commit Date,Committer,Committed In Branch,Action" > merged_branches_report.csv
3535
for branch in $(git for-each-ref --format '%(refname:short) %(committerdate:unix)' refs/remotes/origin | awk -v date=$(date -d '3 months ago' +%s) '$2 < date {print $1}'); do
36-
if [[ "$branch" != "origin/main" && "$branch" != "origin/dev" ]]; then
36+
if [[ "$branch" != "origin/main" && "$branch" != "origin/dev" && "$branch" != "origin/demo" ]]; then
3737
branch_name=${branch#origin/}
3838
git fetch origin "$branch_name" || echo "Could not fetch branch: $branch_name"
3939
last_commit_date=$(git log -1 --format=%ci "origin/$branch_name" || echo "Unknown")
@@ -44,7 +44,7 @@ jobs:
4444
done
4545
- name: List PR Approved and Merged Branches Older Than 30 Days
4646
run: |
47-
for branch in $(gh api repos/${{ github.repository }}/pulls --jq '.[] | select(.merged_at != null and (.base.ref == "main" or .base.ref == "dev")) | select(.merged_at | fromdateiso8601 < (now - 2592000)) | .head.ref'); do
47+
for branch in $(gh api repos/${{ github.repository }}/pulls --state closed --paginate --jq '.[] | select(.merged_at != null and (.base.ref == "main" or .base.ref == "dev" or .base.ref == "demo")) | select(.merged_at | fromdateiso8601 < (now - 2592000)) | .head.ref'); do
4848
git fetch origin "$branch" || echo "Could not fetch branch: $branch"
4949
last_commit_date=$(git log -1 --format=%ci origin/$branch || echo "Unknown")
5050
committer_name=$(git log -1 --format=%cn origin/$branch || echo "Unknown")
@@ -55,7 +55,7 @@ jobs:
5555
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5656
- name: List Open PR Branches With No Activity in Last 3 Months
5757
run: |
58-
for branch in $(gh api repos/${{ github.repository }}/pulls --state open --jq '.[] | select(.base.ref == "main" or .base.ref == "dev") | .head.ref'); do
58+
for branch in $(gh api repos/${{ github.repository }}/pulls --state open --jq '.[] | select(.base.ref == "main" or .base.ref == "dev" or .base.ref == "demo") | .head.ref'); do
5959
git fetch origin "$branch" || echo "Could not fetch branch: $branch"
6060
last_commit_date=$(git log -1 --format=%ci origin/$branch || echo "Unknown")
6161
committer_name=$(git log -1 --format=%cn origin/$branch || echo "Unknown")

0 commit comments

Comments
 (0)