Skip to content

Instantly share code, notes, and snippets.

@kholisrag
Last active July 2, 2024 04:43
Show Gist options
  • Save kholisrag/64fd9b73572f80318c5c812e2e28e7ab to your computer and use it in GitHub Desktop.
Save kholisrag/64fd9b73572f80318c5c812e2e28e7ab to your computer and use it in GitHub Desktop.
Github CLI script to rerun checks for PRs used for loadtesting github arc runner scale set - autoscaler
#!/bin/bash
echo "Github CLI script to rerun checks for PRs"
# used for loadtesting github arc runner scale set - autoscaler
export GH_PAGER=""
export REPO_PREFIX="xxx-"
export LIMIT="10"
export PR_SEARCH_QUERY="is:pr is:open draft:false created:>=2024-06-01"
export REPO_SORT="updated" #best-match|forks|help-wanted-issues|stars|updated
while read -r repo; do
echo "Repo: $repo"
while read -r pr; do
echo "PR Number: $pr"
while read -r pr_check; do
echo "PR Check run-id: $pr_check"
gh run rerun $pr_check --repo $repo
done < <(gh pr checks $pr --repo $repo | awk -F'/' '{print $10}' | grep -e '[0-9]' | uniq)
done < <(gh pr list --repo $repo --search "$PR_SEARCH_QUERY" --json 'number' | jq -r '.[].number')
done < <(gh search repos --owner=carousell --limit $LIMIT "$REPO_PREFIX" --sort "$REPO_SORT" | grep private | awk '{print $1}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment