Skip to content

Commit

Permalink
fix(cleanup): update clenaup job
Browse files Browse the repository at this point in the history
  • Loading branch information
Katka92 committed Apr 24, 2024
1 parent 84d23f1 commit e7554a7
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/repos-cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@ jobs:
curl -L -H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/orgs/redhat-hac-qe/repos?per_page=100" | jq --argjson ts "$toDate" -r '.[] | select (.created_at | fromdateiso8601 < $ts) | .name' | grep -E 'test-app-|devfile-sample-go-basic-' >> repos
while read repo; do curl -L -X DELETE -H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/redhat-hac-qe/$repo"; done < repos
"https://api.github.com/orgs/redhat-hac-qe/repos?per_page=100" | jq --argjson ts "$toDate" -r '.[] | select (.created_at | fromdateiso8601 < $ts ) | select ((.description == "GitOps Repository") or (.name | match("devfile-sample-go-basic-"))) | .name' >> repos
while read repo; do
echo "Removing ${repo} repo..."
curl -L -X DELETE -H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/redhat-hac-qe/$repo"
done < repos

0 comments on commit e7554a7

Please sign in to comment.