Skip to content

Commit

Permalink
tc
Browse files Browse the repository at this point in the history
  • Loading branch information
clee2000 committed Oct 7, 2024
1 parent 0b0165f commit 8693cf0
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 51 deletions.
59 changes: 27 additions & 32 deletions .github/actions/update-viablestrict/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,6 @@ runs:
with:
python-version: '3.11'

# - name: Checkout test-infra for the fetch_latest_green_commit scripts
# uses: actions/checkout@v3
# with:
# repository: ${{ inputs.test-infra-repository }}
# ref: ${{ inputs.test-infra-ref }}
# path: test-infra

- uses: actions/checkout@v3
with:
repository: ${{ inputs.repository }}
Expand All @@ -85,34 +78,36 @@ runs:
run: |
set -ex
export PYTHONPATH=${PYTHONPATH}:${GITHUB_ACTION_PATH}/../../..
output=$(python ${GITHUB_ACTION_PATH}/../../../tools/scripts/fetch_latest_green_commit.py \
TEST_INFRA_PATH="${GITHUB_ACTION_PATH}/../../.."
export PYTHONPATH=${PYTHONPATH}:${TEST_INFRA_PATH}
output=$(python ${TEST_INFRA_PATH}/tools/scripts/fetch_latest_green_commit.py \
--required-checks "${{ inputs.requires }}" \
--viable-strict-branch "viable/strict" \
--main-branch "master")
echo "latest_viable_sha=$output" >> "${GITHUB_OUTPUT}"
# - name: Push SHA to viable/strict branch
# if: steps.get-latest-commit.outputs.latest_viable_sha != 'None'
# working-directory: ${{ inputs.repository }}
# id: push-to-stable
# env:
# GITHUB_TOKEN: ${{ inputs.secret-bot-token }}
# STABLE_BRANCH: ${{ inputs.stable-branch }}
# LATEST_VIABLE_SHA: ${{ steps.get-latest-commit.outputs.latest_viable_sha }}
# shell: bash
# run: |
# git config --global user.email "pytorchmergebot@users.noreply.github.com"
# git config --global user.name "PyTorch MergeBot"
- name: Push SHA to viable/strict branch
if: steps.get-latest-commit.outputs.latest_viable_sha != 'None'
working-directory: ${{ inputs.repository }}
id: push-to-stable
env:
GITHUB_TOKEN: ${{ inputs.secret-bot-token }}
STABLE_BRANCH: ${{ inputs.stable-branch }}
LATEST_VIABLE_SHA: ${{ steps.get-latest-commit.outputs.latest_viable_sha }}
shell: bash
run: |
git config --global user.email "pytorchmergebot@users.noreply.github.com"
git config --global user.name "PyTorch MergeBot"
# echo "Set the latest sha variable to be ${LATEST_VIABLE_SHA}"
# # Pushing an older green commit here will fail because it's non-fast-forward, which is ok
# # to ignore because we already have the later green commit in visable/strict
# push_result=$(git push origin "${LATEST_VIABLE_SHA}:${STABLE_BRANCH}" 2>&1 || true)
# {
# echo 'push_result<<EOF'
# echo $push_result
# echo EOF
# } >> "${GITHUB_OUTPUT}"
# echo "${push_result}"
# echo "time=$(date +%s)" >> "${GITHUB_OUTPUT}"
echo "Set the latest sha variable to be ${LATEST_VIABLE_SHA}"
# Pushing an older green commit here will fail because it's non-fast-forward, which is ok
# to ignore because we already have the later green commit in visable/strict
push_result=$(git push origin "${LATEST_VIABLE_SHA}:${STABLE_BRANCH}" 2>&1 || true)
{
echo 'push_result<<EOF'
echo $push_result
echo EOF
} >> "${GITHUB_OUTPUT}"
echo "${push_result}"
echo "time=$(date +%s)" >> "${GITHUB_OUTPUT}"
33 changes: 14 additions & 19 deletions .github/workflows/update-viablestrict.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,6 @@ jobs:
do_update_viablestrict:
runs-on: ubuntu-20.04
steps:
# - name: Checkout ${{ inputs.test-infra-repository }} repo
# uses: actions/checkout@v3
# with:
# repository: ${{ inputs.test-infra-repository }}
# ref: ${{ inputs.test-infra-ref }}
# path: test-infra

- name: Checkout ${{ inputs.repository }} repo
uses: actions/checkout@v3
with:
Expand All @@ -69,23 +62,25 @@ jobs:
run: |
cd ${{ inputs.repository }}
export PYTHONPATH=$PYTHONPATH:${GITHUB_ACTION_PATH}/test-infra
output=$(python3 ${GITHUB_ACTION_PATH}/tools/scripts/fetch_latest_green_commit.py \
TEST_INFRA_PATH="${GITHUB_ACTION_PATH}/../../.."
export PYTHONPATH=$PYTHONPATH:${TEST_INFRA_PATH}
output=$(python3 ${TEST_INFRA_PATH}/tools/scripts/fetch_latest_green_commit.py \
--required-checks "${{ inputs.required_checks }}" \
--viable-strict-branch "${{ inputs.viable_strict_branch }}" \
--main-branch "main")
echo "latest_viable_sha=$output" >> "${GITHUB_OUTPUT}"
id: get-latest-commit

# - name: Push SHA to viable/strict branch
# if: steps.get-latest-commit.outputs.latest_viable_sha != 'None'
# run: |
# cd ${{ inputs.repository }}
- name: Push SHA to viable/strict branch
if: steps.get-latest-commit.outputs.latest_viable_sha != 'None'
run: |
cd ${{ inputs.repository }}
# git config user.name 'github-actions[bot]'
# git config user.email 'github-actions[bot]@users.noreply.github.com'
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
# echo "Set the latest sha variable to be ${{ steps.get-latest-commit.outputs.latest_viable_sha }}"
# # Pushing an older green commit here will fail because it's non-fast-forward, which is ok
# # to ignore because we already have the later green commit in viable/strict
# git push origin "${{ steps.get-latest-commit.outputs.latest_viable_sha }}":${{ inputs.viable_strict_branch }}
echo "Set the latest sha variable to be ${{ steps.get-latest-commit.outputs.latest_viable_sha }}"
# Pushing an older green commit here will fail because it's non-fast-forward, which is ok
# to ignore because we already have the later green commit in viable/strict
git push origin "${{ steps.get-latest-commit.outputs.latest_viable_sha }}":${{ inputs.viable_strict_branch }}

0 comments on commit 8693cf0

Please sign in to comment.