r-universe-org / help

Support and bug tracker for R-universe
https://docs.r-universe.dev/
9 stars 2 forks source link

Using github "deployments" API #319

Closed jeroen closed 9 months ago

jeroen commented 11 months ago

First you create a "deployment" event, and then you need to update the status to success/failure.

I think environment needs to be the package name when we create the deployment in the monorepo, because it is assumed a subsequent deployment to the same environment overwrites the previous one.

res <- gh::gh('POST /repos/r-universe/jeroen/deployments', 
              ref = '6b77ffa52ed26eea46697f5428d2ab1235284066',
              task = 'deploy', environment = 'curl',
              description = 'Deploy to https://jeroen.r-universe.dev/curl', 
              auto_merge=FALSE, 
              required_contexts=vector())

res2 <- gh::gh('POST /repos/r-universe/jeroen/deployments/{deployment_id}/statuses', 
               deployment_id = res$id, state = 'success', target_url = 'https://jeroen.r-universe.dev/curl',
               description = 'Deployment to r-universe was successful!')
jeroen commented 9 months ago

Tried this but disabled it again because it may not be too useful and adds a lot of noise. But the code is still here: https://github.com/r-universe-org/commit-status/blob/master/R/deployment.R