Pass latest commit ref to checkout
This commit is contained in:
7
.github/workflows/e2e-tests.yml
vendored
7
.github/workflows/e2e-tests.yml
vendored
@@ -8,6 +8,11 @@ on:
|
|||||||
|
|
||||||
# For test.yml to call this workflow
|
# For test.yml to call this workflow
|
||||||
workflow_call:
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
ref:
|
||||||
|
description: "Git ref to checkout"
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
secrets:
|
secrets:
|
||||||
OP_CONNECT_CREDENTIALS:
|
OP_CONNECT_CREDENTIALS:
|
||||||
required: true
|
required: true
|
||||||
@@ -34,6 +39,7 @@ jobs:
|
|||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v5
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
ref: ${{ inputs.ref }}
|
||||||
|
|
||||||
- name: Generate .env.tpl
|
- name: Generate .env.tpl
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -101,6 +107,7 @@ jobs:
|
|||||||
uses: actions/checkout@v5
|
uses: actions/checkout@v5
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
ref: ${{ inputs.ref }}
|
||||||
|
|
||||||
- name: Generate .env.tpl
|
- name: Generate .env.tpl
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
6
.github/workflows/test-e2e.yml
vendored
6
.github/workflows/test-e2e.yml
vendored
@@ -26,6 +26,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
condition: ${{ steps.check.outputs.condition }}
|
condition: ${{ steps.check.outputs.condition }}
|
||||||
|
ref: ${{ steps.check.outputs.ref }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check if PR is from external contributor
|
- name: Check if PR is from external contributor
|
||||||
id: check
|
id: check
|
||||||
@@ -45,6 +46,7 @@ jobs:
|
|||||||
else
|
else
|
||||||
echo "condition=pr-creation-maintainer" >> $GITHUB_OUTPUT
|
echo "condition=pr-creation-maintainer" >> $GITHUB_OUTPUT
|
||||||
echo "Setting condition=pr-creation-maintainer (internal PR creation)"
|
echo "Setting condition=pr-creation-maintainer (internal PR creation)"
|
||||||
|
echo "ref=${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
elif [ "${{ github.event_name }}" == "repository_dispatch" ]; then
|
elif [ "${{ github.event_name }}" == "repository_dispatch" ]; then
|
||||||
# For repository_dispatch events (ok-to-test), check if sha matches
|
# For repository_dispatch events (ok-to-test), check if sha matches
|
||||||
@@ -58,6 +60,7 @@ jobs:
|
|||||||
if [ -n "$SHA_PARAM" ] && [[ "$PR_HEAD_SHA" == *"$SHA_PARAM"* ]]; then
|
if [ -n "$SHA_PARAM" ] && [[ "$PR_HEAD_SHA" == *"$SHA_PARAM"* ]]; then
|
||||||
echo "condition=dispatch-event" >> $GITHUB_OUTPUT
|
echo "condition=dispatch-event" >> $GITHUB_OUTPUT
|
||||||
echo "Setting condition=dispatch-event (sha matches)"
|
echo "Setting condition=dispatch-event (sha matches)"
|
||||||
|
echo "ref=$PR_HEAD_SHA" >> $GITHUB_OUTPUT
|
||||||
else
|
else
|
||||||
echo "condition=skip" >> $GITHUB_OUTPUT
|
echo "condition=skip" >> $GITHUB_OUTPUT
|
||||||
echo "Setting condition=skip (sha does not match or empty)"
|
echo "Setting condition=skip (sha does not match or empty)"
|
||||||
@@ -65,6 +68,7 @@ jobs:
|
|||||||
elif [ "${{ github.event_name }}" == "push" ] && [ "${{ github.ref_name }}" == "main" ]; then
|
elif [ "${{ github.event_name }}" == "push" ] && [ "${{ github.ref_name }}" == "main" ]; then
|
||||||
echo "condition=push-to-main" >> $GITHUB_OUTPUT
|
echo "condition=push-to-main" >> $GITHUB_OUTPUT
|
||||||
echo "Setting condition=push-to-main (push to main)"
|
echo "Setting condition=push-to-main (push to main)"
|
||||||
|
echo "ref=${{ github.sha }}" >> $GITHUB_OUTPUT
|
||||||
else
|
else
|
||||||
# Unknown event type
|
# Unknown event type
|
||||||
echo "condition=skip" >> $GITHUB_OUTPUT
|
echo "condition=skip" >> $GITHUB_OUTPUT
|
||||||
@@ -80,6 +84,8 @@ jobs:
|
|||||||
||
|
||
|
||||||
needs.check-external-pr.outputs.condition == 'push-to-main'
|
needs.check-external-pr.outputs.condition == 'push-to-main'
|
||||||
uses: ./.github/workflows/e2e-tests.yml
|
uses: ./.github/workflows/e2e-tests.yml
|
||||||
|
with:
|
||||||
|
ref: ${{ needs.check-external-pr.outputs.ref }}
|
||||||
secrets:
|
secrets:
|
||||||
OP_CONNECT_CREDENTIALS: ${{ secrets.OP_CONNECT_CREDENTIALS }}
|
OP_CONNECT_CREDENTIALS: ${{ secrets.OP_CONNECT_CREDENTIALS }}
|
||||||
OP_CONNECT_TOKEN: ${{ secrets.OP_CONNECT_TOKEN }}
|
OP_CONNECT_TOKEN: ${{ secrets.OP_CONNECT_TOKEN }}
|
||||||
|
|||||||
Reference in New Issue
Block a user