|
33 | 33 | run: | |
34 | 34 | echo "Branch Name,Last Commit Date,Committer,Committed In Branch,Action" > merged_branches_report.csv |
35 | 35 | 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 |
37 | 37 | branch_name=${branch#origin/} |
38 | 38 | git fetch origin "$branch_name" || echo "Could not fetch branch: $branch_name" |
39 | 39 | last_commit_date=$(git log -1 --format=%ci "origin/$branch_name" || echo "Unknown") |
|
44 | 44 | done |
45 | 45 | - name: List PR Approved and Merged Branches Older Than 30 Days |
46 | 46 | 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 |
48 | 48 | git fetch origin "$branch" || echo "Could not fetch branch: $branch" |
49 | 49 | last_commit_date=$(git log -1 --format=%ci origin/$branch || echo "Unknown") |
50 | 50 | committer_name=$(git log -1 --format=%cn origin/$branch || echo "Unknown") |
|
55 | 55 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
56 | 56 | - name: List Open PR Branches With No Activity in Last 3 Months |
57 | 57 | 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 |
59 | 59 | git fetch origin "$branch" || echo "Could not fetch branch: $branch" |
60 | 60 | last_commit_date=$(git log -1 --format=%ci origin/$branch || echo "Unknown") |
61 | 61 | committer_name=$(git log -1 --format=%cn origin/$branch || echo "Unknown") |
|
0 commit comments