From 8f09dd89f62c488f963a635283ce645ea83f522d Mon Sep 17 00:00:00 2001 From: Yih-Dar <2521628+ydshieh@users.noreply.github.com> Date: Tue, 3 Jan 2023 16:19:38 +0100 Subject: [PATCH] Avoid CI runs under users' own CircleCI personal account (#20981) * Avoid null CI * Avoid null CI * rename * more clear error message * Update .circleci/config.yml Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com> * clean up Co-authored-by: ydshieh Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com> --- .circleci/config.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index bc0973d8348..7b839f250dc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,6 +9,19 @@ parameters: default: false jobs: + # Ensure running with CircleCI/huggingface + check_circleci_user: + docker: + - image: cimg/python:3.7.12 + parallelism: 1 + steps: + - run: echo $CIRCLE_PROJECT_USERNAME + - run: | + if [ "$CIRCLE_PROJECT_USERNAME" = "huggingface" ]; then + exit 0 + else + echo "The CI is running under $CIRCLE_PROJECT_USERNAME personal account. Please follow https://support.circleci.com/hc/en-us/articles/360008097173-Troubleshooting-why-pull-requests-are-not-triggering-jobs-on-my-organization- to fix it."; exit -1 + fi # Fetch the tests to run fetch_tests: working_directory: ~/transformers @@ -171,6 +184,7 @@ workflows: when: not: <> jobs: + - check_circleci_user - check_code_quality - check_repository_consistency - fetch_tests @@ -178,6 +192,7 @@ workflows: nightly: when: <> jobs: + - check_circleci_user - check_code_quality - check_repository_consistency - fetch_all_tests \ No newline at end of file