Skip to content

Commit

Permalink
Add Update Checker workflow file
Browse files Browse the repository at this point in the history
  • Loading branch information
P3TERX committed Jan 2, 2021
1 parent 8c20d95 commit b6336ca
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/update-checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#
# Copyright (c) 2019-2021 P3TERX <https://p3terx.com>
#
# This is free software, licensed under the MIT License.
# See /LICENSE for more information.
#
# https://github.com/P3TERX/Actions-OpenWrt
# File: .github/workflows/update-checker.yml
# Description: Source code update checker
#

name: Update Checker

env:
REPO_URL: https://github.com/coolsnowwolf/lede
REPO_BRANCH: master

on:
workflow_dispatch:
# schedule:
# - cron: 0 */18 * * *

jobs:
check:
runs-on: ubuntu-latest

steps:

- name: Get Commit Hash
id: getHash
run: |
git clone --depth 1 $REPO_URL -b $REPO_BRANCH .
echo "::set-output name=commitHash::$(git rev-parse HEAD)"
- name: Compare Commit Hash
id: cacheHash
uses: actions/cache@v2
with:
path: .commitHash
key: HEAD-${{ 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@v1
with:
token: ${{ secrets.ACTIONS_TRIGGER_PAT }}
event-type: Source Code Update

- name: Delete workflow runs
uses: ActionsRML/delete-workflow-runs@main
with:
retain_days: 1
keep_minimum_runs: 1

0 comments on commit b6336ca

Please sign in to comment.