clade outdated #314
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: clade outdated | |
on: | |
workflow_dispatch: | |
inputs: | |
cascade: | |
description: Trigger builds on outdated images | |
required: false | |
default: false | |
type: boolean | |
log-level: | |
description: Log level | |
required: false | |
default: info | |
type: choice | |
options: | |
- fatal | |
- error | |
- warn | |
- info | |
- debug | |
schedule: | |
- cron: "0 0 * * *" | |
jobs: | |
outdated: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: lesomnus/clade/init@main | |
- uses: actions/checkout@v3 | |
- name: Login GHCR | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- id: outdated | |
uses: lesomnus/clade/outdated@main | |
with: | |
log-level: ${{ inputs.log-level || 'info' }} | |
- name: Trigger | |
if: (github.event_name == 'schedule') || inputs.cascade | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
if [ "$(cat ${{ steps.outdated.outputs.plan_name }} | jq '.iterations | length')" = "0" ]; then | |
echo no outdated images | |
return | |
fi | |
cat "${{ steps.outdated.outputs.plan-name }}" | jq -r '.iterations[0][][0]' | while read ref; do | |
echo trigger build for ${ref} | |
gh workflow run clade-iterate.yaml \ | |
--ref "${{ github.ref }}" \ | |
--field "plan-name=${{ steps.outdated.outputs.plan-name }}" \ | |
--field "reference=${ref}" \ | |
--field "cascade=true" \ | |
--field "log-level=${{ inputs.log-level || 'info' }}" | |
done |