Update diy-part2.sh #214
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
# | |
# https://github.com/P3TERX/Actions-OpenWrt | |
# | |
# File: .github/workflows/update-checker.yml | |
# Description: Source code update checker | |
# | |
# Copyright (c) 2019-2024 P3TERX <https://p3terx.com> | |
# | |
# This is free software, licensed under the MIT License. | |
# See /LICENSE for more information. | |
# | |
#name: Update Checker | |
#env: | |
# REPO_URL: https://github.com/openwrt/openwrt | |
#on: | |
# workflow_dispatch: | |
# schedule: | |
# - cron: 0 */18 * * * | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get latest release | |
run: | | |
latest_release="$(curl -s https://github.com/openwrt/openwrt/tags | grep -Eo "v[0-9\.]+\-*r*c*[0-9]*.tar.gz" | sed -n '/[2-9][3-9]/p' | sed -n 1p | sed 's/.tar.gz//g')" | |
echo "REPO_BRANCH=${latest_release}" >> $GITHUB_ENV | |
- name: Get Commit Hash | |
id: getHash | |
run: | | |
git clone --depth 1 $REPO_URL -b $REPO_BRANCH . | |
echo "commitHash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT | |
- name: Compare Commit Hash | |
id: cacheHash | |
uses: actions/cache@main | |
with: | |
path: .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 .commitHash | |
- name: Trigger build | |
if: steps.cacheHash.outputs.cache-hit != 'true' | |
uses: peter-evans/repository-dispatch@main | |
with: | |
token: ${{ github.token }} | |
event-type: OpenWrt ziyong,OpenWrt normal,OpenWrt simple | |
- name: Delete workflow runs | |
uses: Mattraks/delete-workflow-runs@main | |
with: | |
retain_days: 0 | |
keep_minimum_runs: 2 |