Skip to content

Commit

Permalink
Testing
Browse files Browse the repository at this point in the history
  • Loading branch information
TaylorHalf committed Oct 18, 2024
1 parent 02a6f1e commit 56fdac8
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions .github/workflows/check-stale-branches.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,16 @@ jobs:

- name: Get commit dates older than stale branch threshold
env:
stale-branch-threshold: "3m"
stale-branch-threshold: "3m"
run: |
three_months_ago=$(date -v-${{ env.stale-branch-threshold }})
three_months_ago=$(date -v-${{ env.stale-branch-threshold }} '+%Y-%m-%d')
for branch in $(jq -r '.[]' <<< '${{ steps.branches.outputs.branches }}'); do
# Fetch commit dates for the branch
commit_dates=$(gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/dvsa/cvs-svc-app-logs/commits?sha=$branch \
--jq '.[].commit.committer.date' 2>/dev/null)
# Search commits in the branch where the author date is older than 3 months
commits=$(gh search commits --author-date="<${three_months_ago}" --repo dvsa/cvs-svc-app-logs --branch $branch --limit 100 --json commit,committerDate --jq '.[] | "\(.commit.oid) \(.committerDate)"')
for commit_date in $commit_dates; do
if [[ "$commit_date" < "$three_months_ago" ]]; then
echo "Branch $branch has commits older than $three_months_ago=: $commit_date"
fi
done
done
if [ -n "$commits" ]; then
echo "Branch $branch has commits older than $three_months_ago:"
echo "$commits"
fi
done

0 comments on commit 56fdac8

Please sign in to comment.