File tree Expand file tree Collapse file tree 2 files changed +16
-7
lines changed
Expand file tree Collapse file tree 2 files changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ name: Build OpenWrt
1212
1313on :
1414 repository_dispatch :
15- types : [Source Code Update ]
15+ types : [Build_OpenWrt ]
1616 workflow_dispatch :
1717 inputs :
1818 ssh :
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments