Skip to content

Commit e1b6006

Browse files
authored
Do a dry run of stubsabot on PRs touching scripts/ or tests/ (#10508)
1 parent 6ca7505 commit e1b6006

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

.github/workflows/typecheck_typeshed_code.yml renamed to .github/workflows/meta_tests.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
name: Typecheck-typeshed-code
1+
# This workflow is for testing typeshed's scripts and tests themselves
2+
name: Meta-tests
23

34
on:
45
workflow_dispatch:
@@ -9,8 +10,9 @@ on:
910
paths:
1011
- "scripts/**"
1112
- "tests/**"
12-
- ".github/workflows/typecheck_typeshed_code.yml"
13+
- ".github/workflows/meta_tests.yml"
1314
- "requirements-tests.txt"
15+
- "pyproject.toml"
1416

1517
permissions:
1618
contents: read
@@ -68,3 +70,19 @@ jobs:
6870
python-platform: ${{ matrix.python-platform }}
6971
python-version: "3.9"
7072
project: ./pyrightconfig.scripts_and_tests.json
73+
stubsabot-dry-run:
74+
name: Stubsabot dry run
75+
runs-on: ubuntu-latest
76+
steps:
77+
- uses: actions/checkout@v3
78+
- uses: actions/setup-python@v4
79+
with:
80+
python-version: "3.11"
81+
cache: pip
82+
cache-dependency-path: requirements-tests.txt
83+
- name: Git config
84+
run: |
85+
git config --global user.name stubsabot
86+
git config --global user.email '<>'
87+
- run: pip install -r requirements-tests.txt
88+
- run: python scripts/stubsabot.py --action-level local

scripts/stubsabot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ async def main() -> None:
744744
["git", "branch", "--show-current"], text=True, capture_output=True, check=True
745745
).stdout.strip()
746746

747-
if args.action_level >= ActionLevel.fork:
747+
if args.action_level >= ActionLevel.local:
748748
subprocess.check_call(["git", "fetch", "--prune", "--all"])
749749

750750
try:
@@ -784,7 +784,7 @@ async def main() -> None:
784784
finally:
785785
# if you need to cleanup, try:
786786
# git branch -D $(git branch --list 'stubsabot/*')
787-
if args.action_level >= ActionLevel.local:
787+
if args.action_level >= ActionLevel.local and original_branch:
788788
subprocess.check_call(["git", "checkout", original_branch])
789789

790790

0 commit comments

Comments
 (0)