Trigger Release if more than 30 days no releases #99
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: 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@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 # v3.0.0 | |
with: | |
event-type: trigger-release |