rigraph
rigraph copied to clipboard
Try the `setup-air` action?
Now that you've got Air set up, I wonder if you'd be willing to try our new github action: https://www.tidyverse.org/blog/2025/06/air-0-7-0/#github-action
This one uses github suggestions on prs and is my preferred example action
usethis::use_github_action(url = "https://github.com/posit-dev/setup-air/blob/main/examples/format-suggest.yaml")
This one does a simple pass/fail check and runs on push to main and prs, some people may prefer this
usethis::use_github_action(url = "https://github.com/posit-dev/setup-air/blob/main/examples/format-check.yaml")
Either one should help keep all of the igraph developers in sync, avoiding any drift away from Air style
Thanks. I manage my actions centrally, I'll pick this up in due course and apply across all repos.
Experimenting in cdfe5e004a.
#1972
Keeping this open to also add the action-suggester to the overall workflow (very nice)!
Does https://github.com/igraph/rigraph/blob/main/.github/workflows/style/action.yml actually error if there are any changed files that need formatting? I didn't think git status returns an exit code, I thought you'd need git diff --exit-code
The changes are later committed and pushed to the branch if the workflow is permitted. I'm planning to use action-suggester if there is no permission.
I've always disliked the "auto push" back to the branch because it won't retrigger your checks, i.e. this note in setup-air
Note that if you combine this with another action to commit and push these reformatted files back to a branch or pull request, the push will not retrigger any of your GitHub Workflows. This means you won't get any feedback that the push has fixed any broken formatting. Instead, we recommend that you either reformat locally and push the changed files back up using a standard commit, or use the format-suggest.yaml example that adds suggestion comments to your pull request. Both of these methods will retrigger your checks.
So after the auto format runs and pushes back, your typical R checks won't run at all, and the format check won't run again, so you don't ever get the ✅ before you merge, meaning you're kind of flying blind.
The one exception to this seems to be if in your repo you've manually added a personal access token in place of the default GITHUB_TOKEN, which we never do in tidyverse/r-lib, but I guess if you did that then it would work fine
action-suggester doesn't have this problem because a human is the one that commits the formatting changes (by accepting all the suggestion comments), which retriggers all checks
True. In my repos I've taken measures to run the checks also in this case 🙃
On it in https://github.com/r-lib/rprojroot/pull/163 .
Running air now successfully across my repos (only if an air.toml exists), and installing directly for Copilot (here and soon everywhere). Thanks for the pointer!