Skip to content

Update_Checker

Update_Checker #2983

#
# Copyright (c) 2019-2024 smallprogram
#
# This is free software, licensed under the MIT License.
# See /LICENSE for more information.
#
# https://github.com/smallprogram/OpenWrtAction
# File: .github/workflows/Update_Checker.yml
# Description: Source code update checker
#
name: Update_Checker
on:
workflow_dispatch:
inputs:
ssh:
description: 'SSH connection to Actions'
required: false
default: 'false'
schedule:
- cron: 0 4 * * *
# 0 4 * * 5
# 0 4,12,20 * * *
env:
UPDATE_CHECKER: compile_script/update_checker.sh
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: SSH connection to Actions
uses: P3TERX/[email protected]
if: (github.event.inputs.ssh == 'true' && github.event.inputs.ssh != 'false') || contains(github.event.action, 'ssh')
- name: Checkout
uses: actions/checkout@main
with:
fetch-depth: 0
- name: Get Commit Hash
id: getHash
run: |
chmod +x $UPDATE_CHECKER
$GITHUB_WORKSPACE/$UPDATE_CHECKER "https://github.com/immortalwrt/immortalwrt" "01"
$GITHUB_WORKSPACE/$UPDATE_CHECKER "https://github.com/immortalwrt/packages" "02"
$GITHUB_WORKSPACE/$UPDATE_CHECKER "https://github.com/immortalwrt/luci" "03"
$GITHUB_WORKSPACE/$UPDATE_CHECKER "https://github.com/coolsnowwolf/lede" "04"
$GITHUB_WORKSPACE/$UPDATE_CHECKER "https://github.com/coolsnowwolf/packages" "05"
$GITHUB_WORKSPACE/$UPDATE_CHECKER "https://github.com/coolsnowwolf/luci" "06"
$GITHUB_WORKSPACE/$UPDATE_CHECKER "https://github.com/openwrt/openwrt" "07"
$GITHUB_WORKSPACE/$UPDATE_CHECKER "https://github.com/openwrt/packages" "08"
$GITHUB_WORKSPACE/$UPDATE_CHECKER "https://github.com/openwrt/luci" "09"
$GITHUB_WORKSPACE/$UPDATE_CHECKER "https://github.com/openwrt/routing" "10"
$GITHUB_WORKSPACE/$UPDATE_CHECKER "https://github.com/openwrt/telephony" "11"
$GITHUB_WORKSPACE/$UPDATE_CHECKER "https://github.com/xiaorouji/openwrt-passwall-packages" "12"
$GITHUB_WORKSPACE/$UPDATE_CHECKER "https://github.com/xiaorouji/openwrt-passwall" "13"
$GITHUB_WORKSPACE/$UPDATE_CHECKER "https://github.com/xiaorouji/openwrt-passwall2" "14"
$GITHUB_WORKSPACE/$UPDATE_CHECKER "https://github.com/fw876/helloworld" "15"
$GITHUB_WORKSPACE/$UPDATE_CHECKER "https://github.com/vernesong/OpenClash" "16"
- name: Show Commit Head and Combination Heads
id: combHeader
run: |
echo "commitHash_All=\
${{steps.getHash.outputs.SHA_01}}\
${{steps.getHash.outputs.SHA_02}}\
${{steps.getHash.outputs.SHA_03}}\
${{steps.getHash.outputs.SHA_04}}\
${{steps.getHash.outputs.SHA_05}}\
${{steps.getHash.outputs.SHA_06}}\
${{steps.getHash.outputs.SHA_07}}\
${{steps.getHash.outputs.SHA_08}}\
${{steps.getHash.outputs.SHA_09}}\
${{steps.getHash.outputs.SHA_10}}\
${{steps.getHash.outputs.SHA_11}}\
${{steps.getHash.outputs.SHA_12}}\
${{steps.getHash.outputs.SHA_13}}\
${{steps.getHash.outputs.SHA_14}}\
${{steps.getHash.outputs.SHA_15}}\
${{steps.getHash.outputs.SHA_16}}" >> $GITHUB_OUTPUT
- name: Compare Commit Hash
id: cacheHash
uses: actions/cache@v4
with:
path: .commitHash_All
key: HEAD-${{ steps.combHeader.outputs.commitHash_All }}
- name: Save New Commit Hash
if: steps.cacheHash.outputs.cache-hit != 'true'
run: |
echo ${{ steps.combHeader.outputs.commitHash_All }} | tee .commitHash_All
- name: Delete workflow runs
uses: Mattraks/delete-workflow-runs@main
with:
token: ${{ github.token }}
repository: ${{ github.repository }}
retain_days: 1
keep_minimum_runs: 3
- name: Remove old Releases
uses: dev-drprasad/delete-older-releases@master
with:
keep_latest: 10
keep_min_download_counts: 2
delete_expired_data: 60
delete_tags: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Trigger build
if: steps.cacheHash.outputs.cache-hit != 'true'
uses: peter-evans/repository-dispatch@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
event-type: openwrt_source_update