Anand Chowdhary
๐Ÿ“ฆ

Birthday Reminders Action

November 1, 2022
JavaScript
7 stars
3 forks

๐ŸŽ Daily messages for birthday reminders using GitHub Actions

AnandChowdhary/birthday-reminders-actionREADME

๐ŸŽ Birthday Reminders Action

Get daily Telegram messages for birthday reminders using GitHub Actions.

Telegram screenshot

๐ŸŽˆ How it works

Using scheduled workflows, you will receive a Telegram message once every day with a list of birthdays, and once every week with upcoming birthdays you should order gifts for.

๐Ÿ› ๏ธ Setup

Create a new repository with the following environment variables:

  • TELEGRAM_TOKEN - Bot token
  • TELEGRAM_CHAT_ID - Chat ID

Next, create a birthdays.yml file with a list of birthdays you want to track:

- name: Anand Chowdhary
  day: 29
  month: 12
  year: 1997
- name: Sukriti Kapoor
  day: 15
  month: 9
  gift: true

Each person should have a โ€œnameโ€ (string), โ€œmonthโ€ (number), and โ€œdayโ€ (number). Optionally, you can add โ€œyearโ€ (number) to find out how many years old they are, โ€œgiftโ€ (boolean) for whether or not you want to be reminded to purchase a gift, and โ€œmeโ€ (boolean) for a wish for yourself.

Then, create two GitHub Actions workflow files. First, .github/workflows/daily.yml:

name: Daily CI
on:
  schedule:
    - cron: "0 8 * * *"
  workflow_dispatch:
jobs:
  weekly:
    name: Daily birthday reminders
    runs-on: ubuntu-20.04
    steps:
      - name: Checkout
        uses: actions/checkout@v2.3.3
      - name: Send message
        uses: AnandChowdhary/birthday-reminders-action@HEAD
        with:
          command: birthdays-today
        env:
          TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
          TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
      - name: Keep alive
        uses: gautamkrishnar/keepalive-workflow@v2

In the above example, weโ€™ve also included gautamkrishnar/keepalive-workflow to prevent GitHub from disabling scheduled workflows.

And .github/workflows/weekly.yml:

name: Weekly CI
on:
  schedule:
    - cron: "0 8 * * 1"
  workflow_dispatch:
jobs:
  weekly:
    name: Weekly birthday reminders
    runs-on: ubuntu-20.04
    steps:
      - name: Checkout
        uses: actions/checkout@v2.3.3
      - name: Send message
        uses: AnandChowdhary/birthday-reminders-action@HEAD
        with:
          command: upcoming-birthdays
        env:
          TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
          TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}

You can manually trigger the workflow to test it out.

๐Ÿ“„ License