Skip to content

RACO034/cron-apu-timetable

 
 

Repository files navigation

Cron APU Timetable

Prerequisites

  1. nodejs
  2. git
  3. npm
  4. a gcp account
  5. ability to code yourself (just kidding, you'll be guided)

Getting Started

First, clone the repository and install the dependencies.

git clone https://github.com/Hackthletes-APU/cron-apu-timetable.git

cd cron-apu-timetable

npm install

Next, let's setup and configure all the enviroment variables needed to run the project.

Create a new file called .env and copy the contents from .env.example and paste it into the newly created file.

It should look something like this:


// .env
APU_TIMETABLE_S3="S3 PUBLIC LINK"
INTAKE_CODE="YOUR INTAKE CODE"

## GOOGLE SERVICE ACCOUNT VARIABLES
CALENDAR_ID="YOUR CALENDAR ID"
GOOGLE_ACCOUNT_VARIABLES={YOUR_CONVERTED_JSON_TEXT}

You can get the APU_TIMETABLE_S3 by accessing your browser's dev tools when viewing APSpace's timetable.

Google Account Variables actually refer to the JSON file that you can download after creating a service account.

To simplify the process and ensure that the JSON file works in the .env file, I've created a helper function to help you convert the file.

To run it, ensure that you rename the .json file to serviceAccount.json

Then run in the root of the project:

node jsonCoverter.js

It should output the entire file in variable.txt. Copy that and place it directly at GOOGLE_ACCOUNT_VARIABLES in .env.

Deploying to Github Actions

Before setting up Github Actions, make sure you modify the file in ./github/workflows/cron.yml

Last but not least, remember to push the code to Github before setting up Actions.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%