9
9
10
10
jobs :
11
11
needs-e2e :
12
- name : Needs E2E
13
12
runs-on : ubuntu-latest
14
13
outputs :
15
14
needs-e2e : ${{ steps.needs-e2e.outputs.NEEDS_E2E }}
16
15
env :
17
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
18
- # For a `pull_request` event, the branch is `github.head_ref``.
19
- # For a `push` event, the branch is `github.ref_name`.
20
- BRANCH : ${{ github.head_ref || github.ref_name }}
21
16
# For a `pull_request` event, the head commit hash is `github.event.pull_request.head.sha`.
22
17
# For a `push` event, the head commit hash is `github.sha`.
23
18
HEAD_COMMIT_HASH : ${{ github.event.pull_request.head.sha || github.sha }}
24
19
steps :
25
- - name : Checkout and setup environment
26
- uses : MetaMask/action-checkout-and-setup@v1
20
+ - uses : actions/checkout@v4
27
21
with :
28
- is-high-risk-environment : false
29
22
# By default, the checkout action checks out the last merge commit for pull requests.
30
23
# Source: https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#pull_request
31
24
# However, we need the head commit (the latest commit pushed to the source branch)
@@ -37,15 +30,38 @@ jobs:
37
30
id : needs-e2e
38
31
run : |
39
32
if git show --format='%B' --no-patch "${HEAD_COMMIT_HASH}" | grep --fixed-strings --quiet '[skip e2e]'; then
40
- printf '%s\n' "${HEAD_COMMIT_HASH} contains the tag '[skip e2e]' so e2e tests will not run"
33
+ printf '%s\n' "Commit message of ' ${HEAD_COMMIT_HASH}' contains the substring '[skip e2e]' so e2e tests will not run"
41
34
echo "NEEDS_E2E=false" >> "$GITHUB_OUTPUT"
42
35
else
43
- printf '%s\n' "${HEAD_COMMIT_HASH} does not contain the tag '[skip e2e]' so e2e tests will run"
36
+ printf '%s\n' "Commit message of ' ${HEAD_COMMIT_HASH}' does not contain the substring '[skip e2e]' so e2e tests will run"
44
37
echo "NEEDS_E2E=true" >> "$GITHUB_OUTPUT"
45
38
fi
46
39
40
+ changed-files :
41
+ # For a `pull_request` event, the branch is `github.head_ref``.
42
+ # For a `push` event, the branch is `github.ref_name`.
43
+ if : ${{ needs.needs-e2e.outputs.needs-e2e == 'true' && (github.head_ref || github.ref_name) != 'master' }}
44
+ needs :
45
+ - needs-e2e
46
+ runs-on : ubuntu-latest
47
+ env :
48
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
49
+ # For a `pull_request` event, the head commit hash is `github.event.pull_request.head.sha`.
50
+ # For a `push` event, the head commit hash is `github.sha`.
51
+ HEAD_COMMIT_HASH : ${{ github.event.pull_request.head.sha || github.sha }}
52
+ steps :
53
+ - name : Checkout and setup environment
54
+ uses : MetaMask/action-checkout-and-setup@v1
55
+ with :
56
+ is-high-risk-environment : false
57
+ # By default, the checkout action checks out the last merge commit for pull requests.
58
+ # Source: https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#pull_request
59
+ # However, we need the head commit (the latest commit pushed to the source branch)
60
+ # because in the workflow, we would like to parse the latest commit tag.
61
+ # Specifying `ref` ensures that the head commit is checked out directly.
62
+ ref : ${{ env.HEAD_COMMIT_HASH }}
63
+
47
64
- name : Get changed files with git diff
48
- if : ${{ steps.needs-e2e.outputs.NEEDS_E2E == 'true' && env.BRANCH != 'master' }}
49
65
run : yarn tsx .github/scripts/git-diff-default-branch.ts
50
66
51
67
- name : Upload changed files artifact
55
71
path : ./changed-files/
56
72
57
73
run-e2e-pom-validation :
74
+ if : ${{ needs.needs-e2e.outputs.needs-e2e == 'true' && (github.head_ref || github.ref_name) != 'master' }}
58
75
needs :
59
76
- needs-e2e
77
+ - changed-files
60
78
runs-on : ubuntu-latest
61
79
steps :
62
80
- name : Checkout and setup environment
65
83
is-high-risk-environment : false
66
84
67
85
- name : Download changed-files artifact
68
- continue-on-error : true
69
86
uses : actions/download-artifact@v4
87
+ continue-on-error : true
70
88
with :
71
89
name : changed-files
72
90
path : ./changed-files/
0 commit comments