Skip to content

Commit

Permalink
Do a dry run of stubsabot on PRs touching scripts/ or tests/ (pyt…
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexWaygood authored Sep 23, 2023
1 parent 6ca7505 commit e1b6006
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -68,3 +70,19 @@ jobs:
python-platform: ${{ matrix.python-platform }}
python-version: "3.9"
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
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
4 changes: 2 additions & 2 deletions scripts/stubsabot.py
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,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:
Expand Down Expand Up @@ -784,7 +784,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])


Expand Down

0 comments on commit e1b6006

Please sign in to comment.