-
-
Notifications
You must be signed in to change notification settings - Fork 43
52 lines (47 loc) · 1.87 KB
/
cron.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: "Cron ➕ workflows"
on:
schedule:
- cron: '*/10 * * * *'
workflow_dispatch:
inputs:
dispatch-fqwn:
description: 'Dispatch workflow (fully qualified workflow name)'
required: false
default: ''
jobs:
check-lambda-app:
runs-on: ubuntu-latest
steps:
- name: "Next app checker"
if: github.event.inputs.dispatch-fqwn == ''
run: |
jsonW=`curl -L --silent https://phpsecu.re/api/registry/workflow`
nextAW=`echo $jsonW | grep '^{' | jq -r .need_workflow[0]`
if [[ "$nextAW" == "" || "$nextAW" == "null" ]]; then echo "[INFO] No workflow in queue"; exit 0; fi
fqwn=`echo "$nextAW" | jq -r .fqwn`;
echo "FQWN=$fqwn" >> $GITHUB_ENV
- name: "Dispatched setter (fqwn)"
if: github.event.inputs.dispatch-fqwn != ''
run: |
echo "FQWN=${{ github.event.inputs.dispatch-fqwn }}" >> $GITHUB_ENV
- name: "FQWN Parser"
if: env.FQWN != ''
run: |
fqwn=${{ env.FQWN }}
board="$(echo $fqwn | cut -d':' -f1)"
platform="$(echo $fqwn | cut -d':' -f2)"
folder="$(echo $fqwn | cut -d':' -f3)"
repo="$(echo $fqwn | cut -d':' -f4)"
app_slug="${repo//\//_}"
app_path="$folder/$repo.json"
jsonString="{\"board-name\":\"$board\", \"platform-name\":\"$platform\", \"remote-app-path\":\"$app_path\", \"remote-app-slug\":\"$app_slug\", \"remote-repo-slug\":\"$repo\"}"
echo "WORKFLOW_NAME=Dispatched Build" >> $GITHUB_ENV
echo "JSON_INPUTS=$jsonString" >> $GITHUB_ENV
- name: "Dispatch"
if: env.WORKFLOW_NAME != ''
uses: benc-uk/workflow-dispatch@v1
with:
workflow: ${{ env.WORKFLOW_NAME }}
repo: ${{ secrets.REGISTRY_REPOSITORY }}
token: ${{ secrets.GHTOKEN }}
inputs: '${{ env.JSON_INPUTS }}'