Skip to content

Commit

Permalink
fixed determine-test-metadata to use current branch as default branch (
Browse files Browse the repository at this point in the history
…#14897)

* fixed determine-test-metadata to use current branch as default branch

---------

Co-authored-by: Zac Yang <[email protected]>
  • Loading branch information
yzaccc and Zac Yang authored Oct 9, 2024
1 parent dd25217 commit d62bef5
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions .github/workflows/forge-stable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,26 +68,19 @@ jobs:
elif [[ "${{ github.event_name }}" == "push" ]]; then
echo "Branch: ${{ github.ref_name }}"
echo "BRANCH=${{ github.ref_name }}" >> $GITHUB_OUTPUT
else
echo "Using GIT_SHA"
# on workflow_dispatch, this will simply use the inputs.GIT_SHA given (or the default)
# on pull_request, this will default to null and the following "checkout" step will use the PR's base branch
# on workflow_dispatch, this will simply use the inputs.GIT_SHA given (or the default)
elif [[ -n "${{ inputs.GIT_SHA }}" ]]; then
echo "BRANCH=${{ inputs.GIT_SHA }}" >> $GITHUB_OUTPUT
# if GIT_SHA not provided, use the branch where workflow runs on
else
echo "BRANCH=${{ github.head_ref }}" >> $GITHUB_OUTPUT
fi
# Use the branch hash instead of the full branch name to stay under kubernetes namespace length limit
- name: Hash the branch
id: hash-branch
run: |
# If BRANCH is empty, default to "main"
if [ -z "${{ steps.determine-test-branch.outputs.BRANCH }}" ]; then
BRANCH="main"
else
BRANCH="${{ steps.determine-test-branch.outputs.BRANCH }}"
fi
# Hashing the branch name
echo "BRANCH_HASH=$(echo -n "$BRANCH" | sha256sum | cut -c1-10)" >> $GITHUB_OUTPUT
echo "BRANCH_HASH=$(echo -n "${{ steps.determine-test-branch.outputs.BRANCH }}" | sha256sum | cut -c1-10)" >> $GITHUB_OUTPUT
- uses: aptos-labs/aptos-core/.github/actions/check-aptos-core@main
with:
Expand All @@ -111,7 +104,7 @@ jobs:
branch: ${{ steps.determine-test-branch.outputs.BRANCH }}
variants: "failpoints performance"

- uses: ./.github/actions/determine-or-use-target-branch-and-get-last-released-image
- uses: aptos-labs/aptos-core/.github/actions/determine-or-use-target-branch-and-get-last-released-image@main
id: get-last-released-image-tag-for-compat-test
with:
base-branch: ${{ steps.determine-test-branch.outputs.BRANCH }}
Expand Down

0 comments on commit d62bef5

Please sign in to comment.