Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub Actions: Styler #248

Merged
merged 21 commits into from
Sep 29, 2020
Merged

GitHub Actions: Styler #248

merged 21 commits into from
Sep 29, 2020

Conversation

cansavvy
Copy link
Contributor

@cansavvy cansavvy commented Sep 29, 2020

Purpose:

Closes #231

This PR adds a step to the GHA workflow that styles all the Rmd files upon a PR or merge with master.
It also includes a slight modification to docker-build.yml so that builds only happen when changes to the Dockerfile occur.

styler.yml defined GHAs pull the rocker/tidyverse image and runs it on there since styler needs knitr for styling Rmds and we also need git for the committing step. The commit that says Style Rmds is where that occurred.

It is likely that this styler.yml file will later be modified so it handles spell checking as well, but that will be in a future PR.

@jashapiro
Copy link
Member

It looks like this is not quite working as expected. For the pull request, it seems not be getting the branch info, so it is not pushing changes back to the branch.

On checkout, we get:

 /usr/bin/git checkout --progress --force refs/remotes/pull/248/merge
  Note: switching to 'refs/remotes/pull/248/merge'.
  
  You are in 'detached HEAD' state. You can look around, make experimental
  changes and commit them, and you can discard any commits you make in this
  state without impacting any branches by switching back to a branch.
  
  If you want to create a new branch to retain commits you create, you may
  do so (now or later) by using -c with the switch command. Example:
  
    git switch -c <new-branch-name>
  
  Or undo this operation with:
  
    git switch -
  
  Turn off this advice by setting config variable advice.detachedHead to false
  
  HEAD is now at 84e5dbe Merge d5b1720e4d13d860c2486145f82dbb9e026aa6e6 into 7b90e967f96ed6846cb77c40bcdeb48bb3fc13ea
/usr/bin/git log -1 --format='%H'
'84e5dbe88e18e616d121d5323033e0a4ba11ed2a'

Then on commit, we get the following:

[detached HEAD 7db424c] Style Rmds
 12 files changed, 657 insertions(+), 469 deletions(-)
fatal: You are not currently on a branch.
To push the history leading to the current (detached HEAD)
state now, use

@cansavvy
Copy link
Contributor Author

It looks like this is not quite working as expected. For the pull request, it seems not be getting the branch info, so it is not pushing changes back to the branch.

I saw this, I'm trying to use the with: ref: thing mentioned here: actions/checkout#124

@jashapiro
Copy link
Member

It looks like this is not quite working as expected. For the pull request, it seems not be getting the branch info, so it is not pushing changes back to the branch.

I saw this, I'm trying to use the with: ref: thing mentioned here: actions/checkout#124

I was just going to point to that... seems to have worked!

@cansavvy cansavvy changed the title WIP: GitHub Actions: Styler GitHub Actions: Styler Sep 29, 2020
@cansavvy
Copy link
Contributor Author

I think this is ready for review, but I don't know what the status of the docker-build stuff is, @jashapiro ? Do we still want the changes to docker-build.yml you had originally said and that we made here?

@cansavvy
Copy link
Contributor Author

You'll notice there's a lot of styled files here, they are mainly files that haven't been updated yet because the styler action runs on all Rmds. Or there we a couple stylings I introduced as a test (which turned out we didn't need tests because of the old files).

@cansavvy cansavvy marked this pull request as ready for review September 29, 2020 16:14
Copy link
Member

@jashapiro jashapiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me! And it seems to do what we want, so let's add it in!

@cansavvy cansavvy merged commit 7d969d2 into master Sep 29, 2020
@cansavvy cansavvy deleted the cansavvy/gha-styler branch September 29, 2020 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Automation: run styler with GitHub Actions
3 participants