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

Add some logic to pass the correct github ref to mcp script #1990

Merged
merged 3 commits into from
Feb 22, 2023
Merged
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
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}