Skip to content

Commit

Permalink
Add some logic to pass the correct github ref to mcp script (#1990)
Browse files Browse the repository at this point in the history
  • Loading branch information
bandish-shah authored Feb 22, 2023
1 parent c9b7524 commit ee925f4
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/pytest-gpu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,19 @@ jobs:
id: tests
run: |
set -ex
export PR_NUMBER=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")
python .github/mcp/mcp_pytest.py --image '${{ inputs.container }}' --pr_number $PR_NUMBER --pytest_markers '${{ inputs.pytest-markers }}' --pytest_command '${{ inputs.pytest-command }}' --timeout ${{ inputs.mcloud-timeout }}
PR_NUMBER="$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")"
REF_ARGS=""
# Use the PR number if it exists, commit SHA for protected branches and the branch name otherwise
if [ -z "$PR_NUMBER" ]; then
if [[ "$GITHUB_REF" =~ "refs/heads/dev" || "$GITHUB_REF" =~ "refs/heads/main" || "$GITHUB_REF" =~ "refs/heads/release" ]]; then
REF_ARGS="--git_commit $GITHUB_SHA"
else
REF_ARGS="--git_branch $GITHUB_REF_NAME"
fi
else
REF_ARGS="--pr_number $PR_NUMBER"
fi
python .github/mcp/mcp_pytest.py --image '${{ inputs.container }}' --pytest_markers '${{ inputs.pytest-markers }}' --pytest_command '${{ inputs.pytest-command }}' --timeout ${{ inputs.mcloud-timeout }} ${REF_ARGS}

0 comments on commit ee925f4

Please sign in to comment.