Skip to content

repo-activity-check #11

repo-activity-check

repo-activity-check #11

name: repo-activity-check
on:
schedule:
- cron: "0 23 * * 0"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: stale-repo-check
working-directory: ${{ runner.temp }}
env:
GH_TOKEN: ${{ github.token }}
run: |
echo "Stale repositories:"
gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"/orgs/cicsdev/repos?type=public&per_page=100&sort=updated&direction=asc" | \
jq -r '.[] | select(.archived==false) | select((.updated_at | fromdateiso8601) < (now | gmtime | .[0] -= 2 | mktime)) | (.updated_at | fromdateiso8601 | strftime("%Y-%m-%d")) + " " + .name' | 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; }