Skip to content

Commit

Permalink
feat: make command to re-run tests for translation PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
OmarIthawi committed Oct 19, 2023
1 parent a4178ed commit 366f54c
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
34 changes: 34 additions & 0 deletions scripts/rerun_tests_for_transifex_bot_pull_requests.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 366f54c

Please sign in to comment.