Skip to content

Trigger Release if more than 30 days no releases #51

Trigger Release if more than 30 days no releases

Trigger Release if more than 30 days no releases #51

name: Trigger Release if more than 30 days no releases
on:
schedule:
# Every Monday at 04:00
- cron: '0 4 * * 1'
jobs:
trigger-check:
name: Check is a new Release needed
runs-on: ubuntu-latest
steps:
- name: Gets latest created release info
id: latest_release_info
uses: jossef/action-latest-release-info@40167002208bfed9f789cccc7d3222fda2d82dd6 # v1.2.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- id: calculation
run: |
RELEASE_TIME="$(date +%s -u -d ${{ steps.latest_release_info.outputs.created_at }})"
TIME_NOW="$(date +%s -u)"
DAYS_AFTER_RELEASE="$(date +%-j -d @$(( $TIME_NOW - $RELEASE_TIME )))"
echo "days_after_release=$DAYS_AFTER_RELEASE" >> $GITHUB_OUTPUT
- name: Repository Dispatch
if: ${{ steps.calculation.outputs.days_after_release > 30 }}
uses: peter-evans/repository-dispatch@bf47d102fdb849e755b0b0023ea3e81a44b6f570 # v2.1.2
with:
event-type: trigger-release