1
1
name : Check MKL_jll Dependency
2
+
2
3
on :
3
4
workflow_call :
4
5
inputs :
5
6
auto_update :
6
7
description : " Automatically update MKL_jll.dep if out of date"
7
- required : false
8
+ required : true
8
9
type : boolean
9
10
default : true
10
11
outputs :
15
16
types : [opened, synchronize, reopened]
16
17
push :
17
18
branches : [pascal]
19
+
18
20
jobs :
19
21
check-mkl-dep :
20
22
runs-on : ubuntu-latest
@@ -24,18 +26,27 @@ jobs:
24
26
outputs :
25
27
is_up_to_date : ${{ steps.check.outputs.is_up_to_date }}
26
28
steps :
29
+ # Add this step at the beginning to set the auto_update value
30
+ - name : Set auto_update
31
+ id : set_auto_update
32
+ run : |
33
+ if [[ "${{ github.event_name }}" == "push" ]]; then
34
+ echo "value=true" >> $GITHUB_OUTPUT
35
+ else
36
+ echo "value=${{ inputs.auto_update }}" >> $GITHUB_OUTPUT
37
+ fi
27
38
- uses : actions/checkout@v4
28
39
with :
29
40
ref : ${{ github.head_ref }}
30
41
token : ${{ secrets.GITHUB_TOKEN }}
31
-
42
+
32
43
- name : Extract current MKL hash from Manifest
33
44
id : extract
34
45
run : |
35
46
CURRENT_HASH=$(awk '/\[\[deps\.MKL_jll\]\]/{flag=1;next}/\[\[/{if(flag){exit}}flag&&/git-tree-sha1/{gsub(/^.*= "|".*$/,"",$0);printf "%s", $0}' Manifest.toml)
36
47
echo "CURRENT_HASH=${CURRENT_HASH}" >> $GITHUB_OUTPUT
37
48
echo "Found current hash: ${CURRENT_HASH}"
38
-
49
+
39
50
- name : Read existing dep file
40
51
id : read
41
52
run : |
@@ -47,16 +58,16 @@ jobs:
47
58
echo "MKL_jll.dep does not exist"
48
59
echo "EXISTING_HASH=" >> $GITHUB_OUTPUT
49
60
fi
50
-
61
+
51
62
- name : Check if update needed
52
63
id : check
53
64
run : |
54
65
CURRENT="${{ steps.extract.outputs.CURRENT_HASH }}"
55
66
EXISTING="${{ steps.read.outputs.EXISTING_HASH }}"
56
-
67
+
57
68
echo "Current hash: ${CURRENT}"
58
69
echo "Existing hash: ${EXISTING}"
59
-
70
+
60
71
if [ -z "$EXISTING" ] || [ "$EXISTING" != "$CURRENT" ]; then
61
72
echo "Update required..."
62
73
echo "UPDATE_NEEDED=true" >> $GITHUB_OUTPUT
@@ -66,23 +77,23 @@ jobs:
66
77
echo "UPDATE_NEEDED=false" >> $GITHUB_OUTPUT
67
78
echo "is_up_to_date=true" >> $GITHUB_OUTPUT
68
79
fi
69
-
80
+
70
81
- name : Fail if out of date and auto-update is disabled
71
- if : steps.check.outputs.UPDATE_NEEDED == 'true' && inputs.auto_update == false
82
+ if : steps.check.outputs.UPDATE_NEEDED == 'true' && steps.set_auto_update.outputs.value == ' false'
72
83
run : |
73
84
echo "MKL_jll.dep is out of date and auto-update is disabled"
74
85
exit 1
75
-
86
+
76
87
- name : Commit and push if changed and auto-update enabled
77
- if : steps.check.outputs.UPDATE_NEEDED == 'true' && inputs.auto_update == true
88
+ if : steps.check.outputs.UPDATE_NEEDED == 'true' && steps.set_auto_update.outputs.value == ' true'
78
89
run : |
79
90
printf "%s" "${{ steps.extract.outputs.CURRENT_HASH }}" > MKL_jll.dep
80
91
git config --global user.name 'github-actions[bot]'
81
92
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
82
93
git add MKL_jll.dep
83
94
git commit -m "Update MKL_jll.dep to match Manifest.toml"
84
95
git push
85
-
96
+
86
97
- name : Comment on PR
87
98
if : steps.check.outputs.UPDATE_NEEDED == 'true' && github.event_name == 'pull_request'
88
99
uses : actions/github-script@v7
96
107
97
108
Previous hash: \`${{ steps.read.outputs.EXISTING_HASH || 'file did not exist' }}\`
98
109
New hash: \`${{ steps.extract.outputs.CURRENT_HASH }}\``
99
- })
110
+ })
0 commit comments