Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[disablebot] Fix workflow when run on PR #6096

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/scripts/update_disabled_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,9 @@ def main() -> None:
help="Set the repo to query the issues from",
)
args = parser.parse_args()
token = os.getenv("GH_PYTORCHBOT_TOKEN")
token = os.getenv("GITHUB_TOKEN")
if not token:
raise RuntimeError("The GH_PYTORCHBOT_TOKEN environment variable is required")
raise RuntimeError("The GITHUB_TOKEN environment variable is required")

# Get the list of disabled issues and sort them
disable_issues = get_disable_issues(token)
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/update_disabled_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ permissions:
jobs:
update-disabled-tests:
runs-on: ubuntu-latest
environment: trigger-nightly
environment: ${{ github.ref == 'refs/heads/main' && 'trigger-nightly' || '' }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -27,8 +27,10 @@ jobs:
# The token is used to confirm issue creator's write permission before
# allowing them to disable jobs. Note that the token needs to have access
# to the target repo, i.e. pytorch/pytorch instead of test-infra. Using
# PyTorch bot token is the most obvious choice.
GH_PYTORCHBOT_TOKEN: ${{ secrets.GH_PYTORCHBOT_TOKEN }}
# PyTorch bot token is the most obvious choice. Outside of the
# environment, we do not have access to this token so fall back to the
# GITHUB_TOKEN.
GITHUB_TOKEN: ${{ github.ref == 'refs/heads/main' && secrets.GH_MERGEBOT_TOKEN || secrets.GITHUB_TOKEN }}
run: |
python3 .github/scripts/update_disabled_issues.py

Expand Down
Loading