Skip to content

Commit 81bc2a5

Browse files
Merge pull request #133 from 1Password/vzt/fix-commit-ref-in-e2e-test-workflow
Pass latest commit ref to checkout
2 parents 5fd6fbc + 1dfe1fc commit 81bc2a5

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

.github/workflows/e2e-tests.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ on:
88

99
# For test.yml to call this workflow
1010
workflow_call:
11+
inputs:
12+
ref:
13+
description: "Git ref to checkout"
14+
required: true
15+
type: string
1116
secrets:
1217
OP_CONNECT_CREDENTIALS:
1318
required: true
@@ -34,6 +39,19 @@ jobs:
3439
uses: actions/checkout@v5
3540
with:
3641
fetch-depth: 0
42+
ref: ${{ inputs.ref }}
43+
44+
- name: Setup Node.js
45+
uses: actions/setup-node@v4
46+
with:
47+
node-version: 20
48+
cache: npm
49+
50+
- name: Install dependencies
51+
run: npm ci
52+
53+
- name: Build actions
54+
run: npm run build:all
3755

3856
- name: Generate .env.tpl
3957
shell: bash
@@ -101,6 +119,19 @@ jobs:
101119
uses: actions/checkout@v5
102120
with:
103121
fetch-depth: 0
122+
ref: ${{ inputs.ref }}
123+
124+
- name: Setup Node.js
125+
uses: actions/setup-node@v4
126+
with:
127+
node-version: 20
128+
cache: npm
129+
130+
- name: Install dependencies
131+
run: npm ci
132+
133+
- name: Build actions
134+
run: npm run build:all
104135

105136
- name: Generate .env.tpl
106137
run: |

.github/workflows/test-e2e.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ jobs:
2626
runs-on: ubuntu-latest
2727
outputs:
2828
condition: ${{ steps.check.outputs.condition }}
29+
ref: ${{ steps.check.outputs.ref }}
2930
steps:
3031
- name: Check if PR is from external contributor
3132
id: check
@@ -45,6 +46,7 @@ jobs:
4546
else
4647
echo "condition=pr-creation-maintainer" >> $GITHUB_OUTPUT
4748
echo "Setting condition=pr-creation-maintainer (internal PR creation)"
49+
echo "ref=${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT
4850
fi
4951
elif [ "${{ github.event_name }}" == "repository_dispatch" ]; then
5052
# For repository_dispatch events (ok-to-test), check if sha matches
@@ -58,13 +60,15 @@ jobs:
5860
if [ -n "$SHA_PARAM" ] && [[ "$PR_HEAD_SHA" == *"$SHA_PARAM"* ]]; then
5961
echo "condition=dispatch-event" >> $GITHUB_OUTPUT
6062
echo "Setting condition=dispatch-event (sha matches)"
63+
echo "ref=$PR_HEAD_SHA" >> $GITHUB_OUTPUT
6164
else
6265
echo "condition=skip" >> $GITHUB_OUTPUT
6366
echo "Setting condition=skip (sha does not match or empty)"
6467
fi
6568
elif [ "${{ github.event_name }}" == "push" ] && [ "${{ github.ref_name }}" == "main" ]; then
6669
echo "condition=push-to-main" >> $GITHUB_OUTPUT
6770
echo "Setting condition=push-to-main (push to main)"
71+
echo "ref=${{ github.sha }}" >> $GITHUB_OUTPUT
6872
else
6973
# Unknown event type
7074
echo "condition=skip" >> $GITHUB_OUTPUT
@@ -80,6 +84,8 @@ jobs:
8084
||
8185
needs.check-external-pr.outputs.condition == 'push-to-main'
8286
uses: ./.github/workflows/e2e-tests.yml
87+
with:
88+
ref: ${{ needs.check-external-pr.outputs.ref }}
8389
secrets:
8490
OP_CONNECT_CREDENTIALS: ${{ secrets.OP_CONNECT_CREDENTIALS }}
8591
OP_CONNECT_TOKEN: ${{ secrets.OP_CONNECT_TOKEN }}

0 commit comments

Comments
 (0)