Skip to content

repo-activity-check

repo-activity-check #4

name: repo-activity-check
on:
schedule:
- cron: "0 23 * * 0"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: check-activity
env:
GH_TOKEN: ${{ github.token }}
run: |
since=$(date -d "2 years ago" "+%Y-%m-%d")
echo "Public repositories:"
gh search repos --owner=cicsdev --visibility=public --archived=false --limit=99 --json=name --jq=.[].name | sort | tee public-repos.txt
echo "Active repositories since $since:"
gh search repos --owner=cicsdev --visibility=public --archived=false --limit=99 --updated=">$since" --json=name --jq=.[].name | sort | tee active-repos.txt
echo "Stale repositories:"
comm -13 active-repos.txt public-repos.txt | tee stale-repos.txt
count=$(wc -l < stale-repos.txt)
[ $count -eq 0 ] || { echo "::error title=Stale repositories::There are $count stale repositories"; exit 1; }