Repository navigation
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/178750
Note: Links to docs will display an error until the docs builds have been completed.
|
ZainRizvi
left a comment
There was a problem hiding this comment.
Thanks for putting this together! I have a suggestion on the approach.
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Fetch and Checkout Upstream |
There was a problem hiding this comment.
test-infra already has a checkout action at pytorch/test-infra/.github/actions/checkout that supports repository, ref, path, fetch-depth, submodules, and token auth — everything this custom action does.
I don't think we need a wrapper action here. Downstream repos can just call the existing checkout action directly with the dispatch payload fields:
# In downstream repo: .github/workflows/pytorch-ci.yml
on:
repository_dispatch:
types: [pytorch-pr-trigger]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: pytorch/test-infra/.github/actions/checkout@main
with:
repository: ${{ github.event.client_payload.upstream_repo }}
ref: ${{ github.event.client_payload.head_sha }}
path: pytorch
fetch-depth: 1
submodules: recursive
- name: Build & test
run: |
cd pytorch
# build pytorch, run downstream tests, etc.The payload field names are stable and documented in the RFC. Using test-infra's checkout also means downstream repos get a smaller, faster checkout of the action itself (vs cloning all of pytorch/pytorch just to get the action).
If we do decide we want a convenience wrapper, it should live in test-infra rather than pytorch/pytorch, and just delegate to the existing checkout action.
There was a problem hiding this comment.
@ZainRizvi Thank you for your valuable suggestions.
Regarding this action, our preliminary idea was to ensure that downstream repositories only perceive the pytorch repository, and not the test-infra and ci-infra repositories. Therefore, we tried adding the action to the pytorch, but this did present some problems. For example, the workflow required cloning the entire pytorch to use the action, which was somewhat wasteful and unreasonable.
Therefore, placing all actions in test-infra seems like a better solution. Given this, I believe the action pytorch/test-infra/.github/actions/checkout is sufficient for our needs and can speed things up.
Furthermore, starting from L2, we need an action to feed the results of the downstream CI back to the HUD, so you think this action should also be placed in test-infra as well, right?
There was a problem hiding this comment.
Hi @ZainRizvi, you're right. We can switch to the standard actions/checkout, as the version in test-infra is a fork and the original should fully meet CRCR's requirements. wdyt? If that sounds good, we can provide guidelines and example downstream workflow YAMLs to assist developers once CRCR L1 is landed.
There was a problem hiding this comment.
Furthermore, starting from L2, we need an action to feed the results of the downstream CI back to the HUD, so you think this action should also be placed in test-infra as well, right?
@fffrog Yes, I think test-infra would be an appropriate place to keep that action. It's our general home for pytorch CI infrastructure that's not limited to the pytorc/pytorch repo
We can switch to the standard actions/checkout, as the version in test-infra is a fork and the original should fully meet CRCR's requirements. wdyt?
@KarhouTam yes, using the default github actions checkout should be just fine
| git submodule update --init --recursive --jobs 8 | ||
|
|
||
| popd | ||
|
|
There was a problem hiding this comment.
Minor: git rev-parse HEAD runs after popd, so it executes in the original working directory, not the checkout path. Would need git -C "${CHECKOUT_PATH}" rev-parse HEAD. Moot if we drop this in favor of the existing checkout action though.
|
Decide to reuse |
Summary
This pull request introduces a new GitHub Action,
Checkout PyTorch PR, which streamlines the process of checking out a specific commit from an upstream PyTorch pull request into a downstream workspace.This encapsulates all necessary git operations, making it easier for downstream repositories to integrate upstream changes without handling git commands or parsing payloads themselves.
New GitHub Action for Upstream PR Checkout:
.github/actions/checkout-upstream-pr/action.ymldefining a composite action that:pathandtokenas inputs for customization.repository_dispatchevent payload.Context
This PR is a part of contribution to the feature: Cross-Repo-CI-Relay
TODO
cc @fffrog @can-gaa-hou @ZainRizvi