Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
sgalsaleh committed Jan 1, 2024
1 parent 00e34d8 commit 4b2b2e0
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/dependabot-prs-manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,21 @@ jobs:
echo "Ensuring required labels..."
gh pr edit ${{ matrix.pr.number }} --add-label "type::security"
echo "Re-running failed tests..."
echo "Re-running tests..."
branch=$(gh pr view ${{ matrix.pr.number }} --json headRefName -q '.headRefName')
run_id=$(gh run list --branch $branch --workflow build-test --limit 1 --json databaseId -q '.[0].databaseId')
gh run rerun $run_id --failed
# If more than half of the validate-* jobs are successful, just re-run the failed jobs.
num_of_jobs=$(gh run view $run_id --json jobs -q '.jobs[] | select(.name | startswith("validate-")) | .name' | wc -l)
num_of_successful_jobs=$(gh run view $run_id --json jobs -q '.jobs[] | select((.name | startswith("validate-")) and (.conclusion == "success")) | .name' | wc -l)
if [ $num_of_successful_jobs -gt $((num_of_jobs / 2)) ]; then
echo "More than half of the validate-* jobs are successful. Re-running failed jobs."
gh run rerun $run_id --failed
exit 0
fi
# Otherwise, re-run all workflows.
echo "Less than half of the validate-* jobs are successful. Re-running all workflows."
git checkout $branch
git commit --allow-empty -m "Re-run workflows"
git push origin $branch

0 comments on commit 4b2b2e0

Please sign in to comment.