Skip to content

Commit

Permalink
[CI] [GHA] Rerun only failed jobs via rerunner (openvinotoolkit#25074)
Browse files Browse the repository at this point in the history
### Tickets:
 - *142219*
  • Loading branch information
akashchi authored Jun 17, 2024
1 parent 44e68a2 commit b9afffe
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion .github/scripts/workflow_rerun/rerunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
import tempfile
from pathlib import Path

import requests
from github import Github, Auth
from workflow_rerun.argument_parser import get_arguments
from workflow_rerun.constants import GITHUB_TOKEN, LOGGER
from workflow_rerun.log_analyzer import LogAnalyzer
from workflow_rerun.log_collector import collect_logs_for_run


if __name__ == '__main__':

args = get_arguments()
Expand Down Expand Up @@ -53,7 +55,12 @@
LOGGER.info(f'RUNNING IN DRY RUN MODE, NOT RETRIGGERING, EXITING')
sys.exit(0)

status = run.rerun()
# PyGitHub does not expose the "/repos/{owner}/{repo}/actions/runs/RUN_ID/rerun-failed-jobs" endpoint
# so we have to use requests
response = requests.post(url=f'https://api.github.com/repos/{repository_name}/actions/runs/{run_id}/rerun-failed-jobs',
headers={'Authorization': f'Bearer {GITHUB_TOKEN}'})
status = response.status_code == 201

if status:
LOGGER.info(f'RUN RETRIGGERED SUCCESSFULLY: {run.html_url}')
else:
Expand Down

0 comments on commit b9afffe

Please sign in to comment.