diff --git a/Makefile b/Makefile index d2a8663ad99..9cb4142edd2 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ .PHONY: piptools upgrade fix_transifex_resource_names translations_scripts_requirements validate_translation_files \ -sync_translations sync_translations_github_workflow +sync_translations sync_translations_github_workflow rerun_tests_for_transifex_bot_pull_requests # Default languages for the sync_translations.py file @@ -46,3 +46,6 @@ sync_translations: ## Syncs from the old projects to the new openedx-translatio sync_translations_github_workflow: ## Run with parameters from .github/workflows/sync-translations.yml make SYNC_ARGS="--simulate-github-workflow $(SYNC_ARGS)" sync_translations +MAX_PULL_REQUESTS_TO_RESTART := 1000 +rerun_tests_for_transifex_bot_pull_requests: ## Re-trigger GitHub Actions all the transifex bot pull requests + bash scripts/rerun_tests_for_transifex_bot_pull_requests.sh diff --git a/scripts/rerun_tests_for_transifex_bot_pull_requests.sh b/scripts/rerun_tests_for_transifex_bot_pull_requests.sh new file mode 100644 index 00000000000..4b53ac24878 --- /dev/null +++ b/scripts/rerun_tests_for_transifex_bot_pull_requests.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +set -e + +if ! test -d .git; then + echo "Error: This script must be run from the root of the openedx-translations repo" + exit 1 +fi + +if ! which gh; then + echo "Error: This script requires the 'gh' command line tool." + echo " See https://cli.github.com/ for installation instructions." + exit 1 +fi + +list_transifex_pull_requests() { + gh pr list -L"${MAX_PULL_REQUESTS_TO_RESTART:-1000}" \ + --search "is:open Updates for file translations/ Transifex Event" \ + --json=number --jq='.[].number' +} + + +re_run_pull_request_tests() { + echo "========================================" + echo "Re-running tests for https://github.com/openedx/openedx-translations/pull/$1"; + gh pr close $1; + gh pr reopen $1; + gh pr merge --auto --rebase $1; +} + + +for pull_request_number in $(list_transifex_pull_requests); do + re_run_pull_request_tests $pull_request_number; +done