Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save svetlyak40wt/cda203d96419d1efe764e889fa58475d to your computer and use it in GitHub Desktop.
Save svetlyak40wt/cda203d96419d1efe764e889fa58475d to your computer and use it in GitHub Desktop.
Use GitHub CLI to enable all workflows that were disabled due to repository inactivity - either for all repos in a given org that you manage, or (by default) your personal repos.
function gh-enable-all-inactivity-disabled-workflows-for-org () {
org=$1
gh repo list --no-archived --limit 1000 $org | cut -f 1 | xargs -I REPO sh -c 'gh workflow list --all -R REPO | grep disabled_inactivity | cut -f 3 | xargs -I WORKFLOW sh -xc "gh workflow enable WORKFLOW -R REPO"'
}
function gh-enable-all-inactivity-disabled-workflows () {
# for user
gh-enable-all-inactivity-disabled-workflows-for-org
# for his organizations
for org in $(gh org list --limit 1000); do
gh-enable-all-inactivity-disabled-workflows-for-org $org
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment