Update Checker #258
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update Checker | |
env: | |
REPO_URL: https://github.com/immortalwrt/immortalwrt | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: 0 20 * * * | |
jobs: | |
Check_Update: | |
runs-on: ubuntu-24.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
info: | |
- '{ "REPO_BRANCH": "openwrt-24.10"}' | |
- '{ "REPO_BRANCH": "openwrt-23.05"}' | |
steps: | |
- name: Get commit hash | |
id: getHash | |
run: | | |
git clone -b ${{fromJSON(matrix.info).REPO_BRANCH}} --single-branch --depth 1 ${{env.REPO_URL}} openwrt | |
cd openwrt | |
echo "commitHash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT | |
- name: Compare commit hash | |
id: cacheHash | |
uses: actions/cache@v4 | |
with: | |
path: ${{fromJSON(matrix.info).REPO_BRANCH}}.commitHash | |
key: commitHash_${{ steps.getHash.outputs.commitHash }} | |
- name: Save new commit hash | |
if: steps.cacheHash.outputs.cache-hit != 'true' | |
run: | | |
echo ${{ steps.getHash.outputs.commitHash }} | tee ${{fromJSON(matrix.info).REPO_BRANCH}}.commitHash | |
- name: Create a repository dispatch event | |
if: steps.cacheHash.outputs.cache-hit != 'true' | |
uses: peter-evans/repository-dispatch@v3 | |
with: | |
event-type: ${{fromJSON(matrix.info).REPO_BRANCH}} | |
Delete_Workflow: | |
needs: [ Check_Update ] | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Delete workflow runs | |
uses: Mattraks/delete-workflow-runs@main | |
with: | |
retain_days: 0 | |
keep_minimum_runs: 2 |