Skip to content

Manage movable holiday events with CI #181

@lemonsaurus

Description

@lemonsaurus

What's the problem?

Some of the events we've got branding for, such as Eid al-Fitr and Holi, fall on different dates every year.

This means we manually update the start and end dates for these in order for the events to happen at the right time of year.

How can we solve that?

One approach is to leverage GitHub Actions to create an automatic pull request with the required changes every year.

For example, on January 1, a Python Discord GitHub App could open a pull request to this repository with all the movable holiday changes required for that year.

Implementation steps

  • Find a free API we can use to look up the start date for these holidays.
  • Get Python Discord admins / owners to create a new GH App that has permission to open pull requests and read code in this repository (and no other permissions). App ID and Key for this app must be added to this repository as repository secrets.
  • Write a GitHub Action that uses schedule as the trigger and runs on January 1st every year. This action can simply check out this repository, and then execute a Python file that will make the required changes to the meta.md files that represent movable holidays.
  • In this action, use something like tibdex/github-app-token@v1 to generate a token with the GitHub App credentials.
  • Use the token when you check out this repository, and then use something like peter-evans/create-pull-request@v3 to create a pull request with the necessary changes.

How do we know which events are movable?

The simplest way to do this would be to just add that information to the meta.md files for each movable holiday.

E.g., we could do something like this:

movable: true
duration: 7 days
holiday_api_name: eid-al-fitr

This will tell us that this event is movable, will last 7 days from the start date, and that you can use eid-al-fitr to look up the start date in the holiday API.

This change would have to be made to all relevant events at the same time as we add this CI.

Metadata

Metadata

Assignees

Labels

level: advancedRequire a lot of skill or experience with the projectpriority: highHigh prioritytype: featureA request for or implementation of a new feature

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions