Skip to content

Commit a0bd6fa

Browse files
committed
Update update-checker.yml
1 parent 3cb77df commit a0bd6fa

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

.github/workflows/build-openwrt.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ name: Build OpenWrt
1212

1313
on:
1414
repository_dispatch:
15-
types: [Source Code Update]
15+
types: [Build_OpenWrt]
1616
workflow_dispatch:
1717
inputs:
1818
ssh:

.github/workflows/update-checker.yml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,29 @@ jobs:
3636
id: cacheHash
3737
uses: actions/cache@v4
3838
with:
39-
path: .commitHash
40-
key: HEAD-${{ steps.getHash.outputs.commitHash }}
39+
path: ./commitHash
40+
key: HEAD-${{ github.sha }}
41+
restore-keys: HEAD-
4142

4243
- name: Save New Commit Hash
43-
if: steps.cacheHash.outputs.cache-hit != 'true'
44+
id: save
4445
run: |
45-
echo ${{ steps.getHash.outputs.commitHash }} | tee .commitHash
46+
if [ -f ./commitHash ];then
47+
cachehash=$(cat ./commitHash)
48+
fi
49+
if [ "${cachehash}" == "${{ steps.getHash.outputs.commitHash }}" ];then
50+
echo "build=false" >> "$GITHUB_OUTPUT"
51+
else
52+
echo "build=true" >> "$GITHUB_OUTPUT"
53+
echo ${{ steps.getHash.outputs.commitHash }} | tee ./commitHash
54+
fi
4655
4756
- name: Trigger build
48-
if: steps.cacheHash.outputs.cache-hit != 'true'
57+
if: steps.save.outputs.build == 'true'
4958
uses: peter-evans/repository-dispatch@v3
5059
with:
5160
token: ${{ secrets.ACTIONS_TRIGGER_PAT }}
52-
event-type: Source Code Update
61+
event-type: Build_OpenWrt
5362

5463
- name: Delete workflow runs
5564
uses: Mattraks/delete-workflow-runs@main

0 commit comments

Comments
 (0)