miraisolutions / covid19-vaccination-ch

Covid 19 Swiss Vaccination article.
GNU General Public License v3.0
4 stars 1 forks source link

Add manual build data trigger in github action #6

Open GuidoMaggio opened 2 years ago

GuidoMaggio commented 2 years ago

In case of failure of the scheduled action that updates the data it may be useful to have a manual trigger.

Translated notes from Riccardo

https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#repository_dispatch as additional on: trigger

on:
  repository_dispatch:
    # trigger from R via:
    # gh::gh("POST /repos/:owner/:repo/dispatches", owner = "miraisolutions", repo = "covid19-vaccination-ch", event_type = "on-demand-build-data")
    types: [on-demand-build-data]

and adding the corresponding if condition

if: github.event_name == 'schedule' || github.event.event_type == 'on-demand-build-data'

The trigger could be done also locally from RStudio

gh::gh("POST /repos/:owner/:repo/dispatches", owner = "miraisolutions", repo = "covid19-vaccination-ch", event_type = "on-demand-build-data")

Assuming there is an environmental variable GITHUB_PAT , or passing the token as argument

.token  (?gh::gh)
GuidoMaggio commented 1 year ago

Not required anymore