Skip to content
This repository was archived by the owner on Jul 11, 2025. It is now read-only.

Commit a79eb5f

Browse files
committed
Different inputs
Signed-off-by: Peter Baker <peter.baker122@csiro.au>
1 parent 8748f89 commit a79eb5f

File tree

1 file changed

+23
-12
lines changed

1 file changed

+23
-12
lines changed

.github/workflows/CheckMklDep.yml

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
name: Check MKL_jll Dependency
2+
23
on:
34
workflow_call:
45
inputs:
56
auto_update:
67
description: "Automatically update MKL_jll.dep if out of date"
7-
required: false
8+
required: true
89
type: boolean
910
default: true
1011
outputs:
@@ -15,6 +16,7 @@ on:
1516
types: [opened, synchronize, reopened]
1617
push:
1718
branches: [pascal]
19+
1820
jobs:
1921
check-mkl-dep:
2022
runs-on: ubuntu-latest
@@ -24,18 +26,27 @@ jobs:
2426
outputs:
2527
is_up_to_date: ${{ steps.check.outputs.is_up_to_date }}
2628
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
2738
- uses: actions/checkout@v4
2839
with:
2940
ref: ${{ github.head_ref }}
3041
token: ${{ secrets.GITHUB_TOKEN }}
31-
42+
3243
- name: Extract current MKL hash from Manifest
3344
id: extract
3445
run: |
3546
CURRENT_HASH=$(awk '/\[\[deps\.MKL_jll\]\]/{flag=1;next}/\[\[/{if(flag){exit}}flag&&/git-tree-sha1/{gsub(/^.*= "|".*$/,"",$0);printf "%s", $0}' Manifest.toml)
3647
echo "CURRENT_HASH=${CURRENT_HASH}" >> $GITHUB_OUTPUT
3748
echo "Found current hash: ${CURRENT_HASH}"
38-
49+
3950
- name: Read existing dep file
4051
id: read
4152
run: |
@@ -47,16 +58,16 @@ jobs:
4758
echo "MKL_jll.dep does not exist"
4859
echo "EXISTING_HASH=" >> $GITHUB_OUTPUT
4960
fi
50-
61+
5162
- name: Check if update needed
5263
id: check
5364
run: |
5465
CURRENT="${{ steps.extract.outputs.CURRENT_HASH }}"
5566
EXISTING="${{ steps.read.outputs.EXISTING_HASH }}"
56-
67+
5768
echo "Current hash: ${CURRENT}"
5869
echo "Existing hash: ${EXISTING}"
59-
70+
6071
if [ -z "$EXISTING" ] || [ "$EXISTING" != "$CURRENT" ]; then
6172
echo "Update required..."
6273
echo "UPDATE_NEEDED=true" >> $GITHUB_OUTPUT
@@ -66,23 +77,23 @@ jobs:
6677
echo "UPDATE_NEEDED=false" >> $GITHUB_OUTPUT
6778
echo "is_up_to_date=true" >> $GITHUB_OUTPUT
6879
fi
69-
80+
7081
- 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'
7283
run: |
7384
echo "MKL_jll.dep is out of date and auto-update is disabled"
7485
exit 1
75-
86+
7687
- 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'
7889
run: |
7990
printf "%s" "${{ steps.extract.outputs.CURRENT_HASH }}" > MKL_jll.dep
8091
git config --global user.name 'github-actions[bot]'
8192
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
8293
git add MKL_jll.dep
8394
git commit -m "Update MKL_jll.dep to match Manifest.toml"
8495
git push
85-
96+
8697
- name: Comment on PR
8798
if: steps.check.outputs.UPDATE_NEEDED == 'true' && github.event_name == 'pull_request'
8899
uses: actions/github-script@v7
@@ -96,4 +107,4 @@ jobs:
96107
97108
Previous hash: \`${{ steps.read.outputs.EXISTING_HASH || 'file did not exist' }}\`
98109
New hash: \`${{ steps.extract.outputs.CURRENT_HASH }}\``
99-
})
110+
})

0 commit comments

Comments
 (0)