Skip to content

Set up GitHub Actions to run map projects every week #45

@Eric-Arellano

Description

@Eric-Arellano

GitHub Actions are a specific implementation of the idea of "continuous integration" (CI) (https://www.atlassian.com/continuous-delivery/continuous-integration). We already use it to run our tests every time we make a change - we can also use it to run certain tasks on a fixed schedule like every week.

This issue is to create a new GitHub Action. In the folder .github/workflows, create a file called weekly.yaml. You can look at https://github.com/ParkingReformNetwork/organization-dashboard/blob/main/.github/workflows/tests.yml as an example.

Set the name to Weekly updates.

--

Replace the on section with something like this:

on:
  workflow_dispatch:
  schedule:
    - cron: '30 5,17 * * *'

See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onschedule about what the schedule part means. Use ChatGPT to figure out what the value would be for every Sunday night around 9 PM PT. (I chose a random time.) Look on GitHub docs what workflow_dispatch means (ctrl-f).

--

Copy over the jobs section from the Test workflow. But rename the name test to instead weekly. And remove the last three steps, Check Typescript, Test, and Lint.

Instead, we want a step with the name Run program, and that runs npm run start -- --services map-projects.

--

There's one last part we need, to set up environment variables, which our how our app reads in secrets like passwords. I've already defined these "Secrets" in our project setup:

  • INFLUXDB_API_TOKEN
  • INFLUXDB_BUCKET
  • INFLUXDB_ORG
  • INFLUXDB_URL

Ask ChatGPT how in GitHub actions to set up environment variables with values from GitHub Actions Secrets.

--

Then, run npm run fmt to autoformat the YAML file. And open a pull request with git push (it will fail - follow the instructions).

I don't think the new action will actually run until we merge it, but that's okay. I think GitHub will say if there are syntax errors. And we can fix issues with followup PRs.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions