nhs-r-community/awesome-nhsr

Add GitHub actions

ChrisBeeley opened this issue · 6 comments

This repo is built automatically from an airtable DB, the .Rmd is rendered to README.md. At the present time the rendering is done manually but I imagine there is a simple way to automate this. The only difficulty I would think would be authenticating to the DB but there must be a way to do this I would have thought (I'm sure it will involve GitHub secrets)

The Airtable DB uses an API and database specific private token. There is also a mechanism within Airtable to have an action trigger something. It looks like you can automate a new GIthub issue I don't know whether that can feed into an automation.

https://support.airtable.com/hc/en-us/articles/4408177288599-Airtable-automation-actions-GitHub

info on the public API https://support.airtable.com/hc/en-us/articles/203313985-Public-REST-API

I'm happy to have a look at the GitHub action to render the document if you want. Few quick observations around the Readme.Rmd:

  1. using pacman: the easiest way to get github actions to work is with renv, not sure how the two interact? I would suggest switching to renv and removing pacman having a quick look
  2. the api key is loaded via the keyringr package: seems sensible. Looking at the doc's I think what we want is a render.R script that will first use backend_env() and github secrets to setup the secret key before calling rmarkdown::render().

Looking at the link @jasonpott provided above from the documentation it looks like airtable will create an issue in the repo - looking at the doc's you can trigger an action from an issue so should be possible!

The other option would be to just simply run the action once per day

@tomjemmett an action has been added that creates an issue in this repository with the label airtable-update.

The issue includes the package name, the description added to the form and the use case.

I think that the action is now functioning - when an issue is labelled with "airtable-update" the action is triggered. It will render the Readme.Rmd then use the action peter-evans/create-pull-request to create a new PR.

The PR it creates is very minimal, and it doesn't like back to the issue that triggered it. We may be able to improve the action step that runs the PR to have better information like a better branch name, description, link to the previous issue (probably using the github.event object).

The idea for PR rather than direct commit is to prevent any thing that we do not approve being auto-pushed up.

Indiscernible from magic.

I don't know if this is pertinent to linking the PR back to the issue?

https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue

Alternatively It would be helpful to see the content of the issue in the PR message so the content being added through the merge can be screened. Even if it was a hyperlink to the issue.

Closed by d0367dc