rigraph icon indicating copy to clipboard operation
rigraph copied to clipboard

Try the `setup-air` action?

Open DavisVaughan opened this issue 5 months ago • 1 comments

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

DavisVaughan avatar Jun 13 '25 12:06 DavisVaughan

Thanks. I manage my actions centrally, I'll pick this up in due course and apply across all repos.

krlmlr avatar Jun 26 '25 08:06 krlmlr

Experimenting in cdfe5e004a.

krlmlr avatar Jul 03 '25 09:07 krlmlr

#1972

maelle avatar Jul 10 '25 08:07 maelle

Keeping this open to also add the action-suggester to the overall workflow (very nice)!

krlmlr avatar Jul 10 '25 08:07 krlmlr

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

DavisVaughan avatar Jul 10 '25 12:07 DavisVaughan

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.

krlmlr avatar Jul 10 '25 12:07 krlmlr

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

DavisVaughan avatar Jul 10 '25 12:07 DavisVaughan

True. In my repos I've taken measures to run the checks also in this case 🙃

krlmlr avatar Jul 10 '25 12:07 krlmlr

On it in https://github.com/r-lib/rprojroot/pull/163 .

krlmlr avatar Aug 25 '25 06:08 krlmlr

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!

krlmlr avatar Oct 26 '25 09:10 krlmlr