Closed andybeet closed 1 year ago
Thanks @andybeet for suggesting this! This is exactly the sort of workflow that would be great to automate. This how I think this could be made into a github action:
Every month (using the cron trigger):
A few questions:
I think the next steps would be to mock this up in a "sandbox" repository before adding it to yours. (e.g., I sometimes test stuff out in this minimal R pkg shell. If we come up with pieces along the way that would be helpful for other R packages, I think they can be added to ghactions4r
!
Happy to talk more about this, and feel free to send me an email or video chat invite if you would like to discuss more details off of github. Either works for me!
@k-doering-NOAA . To answer your questions:
I'd forgotten about the DESCRIPTION file. I'll look into what you suggest.
And yes, if /when we come up with a solution together it would be great to add it to this repo for others.
That all sounds great - looks like you have made good progress already in the testing repo! Since everything is public, I don't think there will be any issues with permissions.
Let me know if you get stuck with a particular part and would like a second pair of eyes/some different ideas. Unfortunately, these sort of jobs are a lot of trial and error (at least for me), so it might take a bit to put together. However, I think it'll ultimately save time.
Another thought about the description file: I used sed because it didn't require installing R which takes time in the workflow, but you could also use R code to do this if you are already installing R (e.g., readLines()
, grep()
statements to change version, the write out the updated description file with writeLines()
)
An idea about the release part, if the automatic release doesn't have the right options: the Github release API could be used instead. I've used this github-script action before (e.g., this workflow to open an issue), although note that the syntax took me a while to figure out because it uses the Octokit syntax. (I think the command would be github.rest.repos.createRelease
, see https://octokit.github.io/rest.js/v18#repos-create-release). There is also an R package called {gh} that could be used instead, and that uses the github API syntax. Here is an opening an issue example using the gh package as the API client . {gh} is probably a good option if you are already installing R in the workflow! One other note is that you may need to create a secret token different than the github_token and add it in the workflow if the workflow posts any API calls to a repo that it is not run in - I don't think this is the case for you, but thought I mention since it took me forever to figure this out last week!
@andybeet, how are things going with this?
@k-doering-NOAA So i have reached a point where i am somewhat happy with the workflow. There are still some manual steps but i am ok with that for now. The final workflow:
GitHub action to:
Then when the email is received, if the report contains changes to the data (most weeks it will not, i hope!!) then i manually:
news.md
DESCRIPTION
fileFor now this works, let's see how long i can stomach this
Here is the repo: https://noaa-edab.github.io/stocksmart/
Thanks, Andy! That seems like you were able to automate a large part of your workflow, which is great! I'm going to close this, but if you think there is anything in the custom workflow you created that should be migrated into ghactions4r for others to use, feel free to reopen and I would to work with you to get it into the package.
Is your feature request related to a problem? Please describe.
I have a workflow that pulls data (monthly) from a website and serves it as an R data object. I dont know how to automatically version the package in a workflow. I also dont know how to add comments to the releases or add to the changelog (news.md)
Describe the solution you would like.
Within the workflow i would like to
Describe alternatives you have considered
I have found several potential actions/solutions but unsure if they are applicable since i dont fully understand
There are many more
Additional context
No response