5
5
pull_request :
6
6
branches :
7
7
- main
8
- - " rc/**"
9
8
- next
10
9
11
10
push :
12
11
branches :
13
12
- main
14
- - " rc/**"
15
13
- next
16
14
15
+ workflow_call :
16
+ inputs :
17
+ ref :
18
+ description : |
19
+ The ref to run the tests on.
20
+ type : string
21
+ required : true
22
+
17
23
env :
18
24
XARGS_MAX_PROCS : 4
19
25
20
26
jobs :
27
+ determine-ref :
28
+ runs-on : ubuntu-latest
29
+ outputs :
30
+ ref : ${{ steps.set-ref.outputs.ref }}
31
+ env :
32
+ REF_FROM_INPUT : ${{ inputs.ref }}
33
+ EVENT_NAME : ${{ github.event_name }}
34
+ steps :
35
+ - id : set-ref
36
+ run : |
37
+ if [[ "$EVENT_NAME" == "workflow_dispatch" ]] || [[ "$EVENT_NAME" == "workflow_call" ]]; then
38
+ echo "ref=$REF_FROM_INPUT" >> "$GITHUB_OUTPUT"
39
+ else
40
+ echo "ref=$GITHUB_REF" >> "$GITHUB_OUTPUT"
41
+ fi
42
+
21
43
prepare-code-scanning-pack-matrix :
22
44
name : Prepare CodeQL Code Scanning pack matrix
45
+ needs : [determine-ref]
23
46
runs-on : ubuntu-22.04
24
47
outputs :
25
48
matrix : ${{ steps.export-code-scanning-pack-matrix.outputs.matrix }}
26
49
steps :
27
50
- name : Checkout repository
28
- uses : actions/checkout@v2
51
+ uses : actions/checkout@v4
52
+ with :
53
+ ref : ${{ needs.determine-ref.outputs.ref }}
29
54
30
55
- name : Export Code Scanning pack matrix
31
56
id : export-code-scanning-pack-matrix
@@ -36,13 +61,15 @@ jobs:
36
61
37
62
create-code-scanning-pack :
38
63
name : Create Code Scanning pack
39
- needs : prepare-code-scanning-pack-matrix
64
+ needs : [ prepare-code-scanning-pack-matrix, determine-ref]
40
65
runs-on : ubuntu-20.04-xl
41
66
strategy :
42
67
fail-fast : false
43
68
matrix : ${{ fromJSON(needs.prepare-code-scanning-pack-matrix.outputs.matrix) }}
44
69
steps :
45
- - uses : actions/checkout@v2
70
+ - uses : actions/checkout@v4
71
+ with :
72
+ ref : ${{ needs.determine-ref.outputs.ref }}
46
73
47
74
- name : Cache CodeQL
48
75
id : cache-codeql
@@ -68,15 +95,15 @@ jobs:
68
95
- name : Checkout external help files
69
96
continue-on-error : true
70
97
id : checkout-external-help-files
71
- uses : actions/checkout@v2
98
+ uses : actions/checkout@v4
72
99
with :
73
100
ssh-key : ${{ secrets.CODEQL_CODING_STANDARDS_HELP_KEY }}
74
101
repository : " github/codeql-coding-standards-help"
75
- ref : ${{ github.head_ref }}
102
+ ref : ${{ needs.determine-ref.outputs.ref }}
76
103
path : external-help-files
77
104
78
105
- name : Include external help files
79
- if : ${{ steps.checkout-external-help-files.outcome == 'success' }}
106
+ if : steps.checkout-external-help-files.outcome == 'success'
80
107
run : |
81
108
pushd external-help-files
82
109
find . -name '*.md' -exec rsync -av --relative {} "$GITHUB_WORKSPACE" \;
0 commit comments