From 30f33ec1e924e0c17ade717035c7734eeb2097e5 Mon Sep 17 00:00:00 2001 From: AlexWaygood Date: Tue, 25 Jul 2023 14:30:07 +0100 Subject: [PATCH 1/4] Do a dry run of stubsabot on PRs touching `scripts/` or `tests/` --- ...check_typeshed_code.yml => meta_tests.yml} | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) rename .github/workflows/{typecheck_typeshed_code.yml => meta_tests.yml} (73%) diff --git a/.github/workflows/typecheck_typeshed_code.yml b/.github/workflows/meta_tests.yml similarity index 73% rename from .github/workflows/typecheck_typeshed_code.yml rename to .github/workflows/meta_tests.yml index f0f6eae83bb5..0ee02f303882 100644 --- a/.github/workflows/typecheck_typeshed_code.yml +++ b/.github/workflows/meta_tests.yml @@ -1,4 +1,5 @@ -name: Typecheck-typeshed-code +# This workflow is for testing typeshed's scripts and tests themselves +name: Meta-tests on: workflow_dispatch: @@ -9,8 +10,9 @@ on: paths: - "scripts/**" - "tests/**" - - ".github/workflows/typecheck_typeshed_code.yml" + - ".github/workflows/meta_tests.yml" - "requirements-tests.txt" + - "pyproject.toml" permissions: contents: read @@ -68,3 +70,18 @@ jobs: python-platform: ${{ matrix.python-platform }} python-version: "3.9" project: ./pyrightconfig.scripts_and_tests.json + stubsabot-dry-run: + name: Stubsabot dry run + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: "3.11" + cache: pip + cache-dependency-path: requirements-tests.txt + - name: Git config + run: | + git config --global user.name stubsabot + git config --global user.email '<>' + - run: pip install -r requirements-tests.txt + - run: python scripts/stubsabot.py --action-level local From 19d31cf47f3e00f22f2fd699ff6a45a79d546e23 Mon Sep 17 00:00:00 2001 From: AlexWaygood Date: Tue, 25 Jul 2023 14:31:57 +0100 Subject: [PATCH 2/4] runs-on --- .github/workflows/meta_tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/meta_tests.yml b/.github/workflows/meta_tests.yml index 0ee02f303882..467d7644d7df 100644 --- a/.github/workflows/meta_tests.yml +++ b/.github/workflows/meta_tests.yml @@ -72,6 +72,7 @@ jobs: project: ./pyrightconfig.scripts_and_tests.json stubsabot-dry-run: name: Stubsabot dry run + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 From 26b05423dfe6dcf7fb3a659844a6cf52af66e556 Mon Sep 17 00:00:00 2001 From: AlexWaygood Date: Tue, 25 Jul 2023 14:39:54 +0100 Subject: [PATCH 3/4] fix script --- scripts/stubsabot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/stubsabot.py b/scripts/stubsabot.py index 5e290f3521e9..2ddd6904061d 100644 --- a/scripts/stubsabot.py +++ b/scripts/stubsabot.py @@ -717,7 +717,7 @@ async def main() -> None: ["git", "branch", "--show-current"], text=True, capture_output=True, check=True ).stdout.strip() - if args.action_level >= ActionLevel.fork: + if args.action_level >= ActionLevel.local: subprocess.check_call(["git", "fetch", "--prune", "--all"]) try: From a829cb7ed237d90ffa2d8410aeedae6bad91978c Mon Sep 17 00:00:00 2001 From: AlexWaygood Date: Tue, 25 Jul 2023 14:46:21 +0100 Subject: [PATCH 4/4] hack... --- scripts/stubsabot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/stubsabot.py b/scripts/stubsabot.py index 2ddd6904061d..d42da6140523 100644 --- a/scripts/stubsabot.py +++ b/scripts/stubsabot.py @@ -757,7 +757,7 @@ async def main() -> None: finally: # if you need to cleanup, try: # git branch -D $(git branch --list 'stubsabot/*') - if args.action_level >= ActionLevel.local: + if args.action_level >= ActionLevel.local and original_branch: subprocess.check_call(["git", "checkout", original_branch])