Skip to content

Send Announcement

Send Announcement #14

Workflow file for this run

name: Announcement
run-name: Send Announcement
on:
schedule:
# the time here is kinda random to dodge high load time on GH that may block cron jobs
# if cron jobs are delayed for too long, they might be dropped -> bad
# - cron: '43 4 1 1 *'
# - cron: '43 4 1 2 *'
# - cron: '43 4 29 1 *'
- cron: '15 19 21 12 *'
- cron: '30 19 21 12 *'
- cron: '45 19 21 12 *'
jobs:
set-visibility:
runs-on: ubuntu-latest
steps:
# set to public at the start of the year
- name: 'Show Repo'
if: github.event.schedule == '15 19 21 12 *'
run: gh repo edit ${{ github.repository }} --visibility public
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
# set to private at the beginning of February
- name: 'Hide Repo'
if: github.event.schedule == '45 19 21 12 *'
run: gh repo edit ${{ github.repository }} --visibility private
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
announce:
needs: set-visibility
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repo'
uses: actions/checkout@v4
- name: 'Setup Deno'
uses: denoland/setup-deno@v1
- name: 'Send Announcement'
run: |
if [ "${{github.event.schedule}}" == '15 19 21 12 *' ]
then
message='The Census Renewal Website is now open! https://lenni009.github.io/Eisvana-Census-Renew/ It will be closed on the 1st of February.'
elif [ "${{github.event.schedule}}" == '45 19 21 12 *' ]
then
message='The Census Renewal Website has closed! It will reopen next year on the 1st of January.'
elif [ "${{github.event.schedule}}" == '30 19 21 12 *' ]
then
message='There are 3 days left to renew your census entry! https://lenni009.github.io/Eisvana-Census-Renew/'
fi
if [ -n "$message" ]
then
deno run --allow-net ./.github/workflows/sendAnnouncement.ts ${{secrets.DISCORD_ANNOUNCEMENT_WEBHOOK}} "$message"
fi
publish:
needs: set-visibility
if: github.event.schedule == '15 19 21 12 *'
permissions:
pages: write
id-token: write
actions: read
uses: ./.github/workflows/deploy-to-pages.yml