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

Automatic GitHub action updates #40

Merged
merged 4 commits into from
Apr 10, 2024
Merged

Automatic GitHub action updates #40

merged 4 commits into from
Apr 10, 2024

Conversation

infinisil
Copy link
Member

@infinisil infinisil commented Apr 10, 2024

This is an alternative to #39. It runs the dependabot CLI locally in the existing weekly update CI action (along with some jq magic). Yet untested in CI, but It also works locally, which is really nice!

Best reviewed commit-by-commit, there's some Nix changes in the first 2 commits.


This work is sponsored by Antithesis

Now using `nix-build -A <tab>` is much smaller
@infinisil
Copy link
Member Author

I renamed the check job to build because it's more accurate considering what it does. I'll have to update the branch protection to change the checks which are required before we can merge it.

@infinisil infinisil marked this pull request as ready for review April 10, 2024 19:15
@infinisil infinisil requested a review from a team as a code owner April 10, 2024 19:15
@infinisil
Copy link
Member Author

@willbush
Copy link
Member

Pretty cool! I'm learning a lot by review this code. I've never used pkgs.writeShellApplication before. Looks useful.

@infinisil
Copy link
Member Author

infinisil commented Apr 10, 2024

Awesome!

Not sure if this needs to be documented anywhere since nobody will actually need to run this locally, but to make it work locally you need a Docker daemon running, which on NixOS means something like this:

{
  virtualisation.docker.enable = true;
  # The default firewall settings block inter-container networking,
  # which is needed by dependabot, so don't run the firewall on docker connections
  networking.firewall.trustedInterfaces = [ "docker0" ];
  # So that your user can access docker without being `root`
  users.users.me.extraGroups = [ "docker" ];
}

@willbush
Copy link
Member

We're you using https://github.com/nektos/act ? (it depends on docker)

@infinisil
Copy link
Member Author

infinisil commented Apr 10, 2024

Nah I'm running it locally by doing what the action does:

nix-build repo -A autoPrUpdate
result/bin/auto-pr-update repo > body

Or within the current directory:

$ nix-build -A autoPrUpdate
$ result/bin/auto-pr-update . > body 

E.g. try downgrading a GitHub Actions dependency and then running that

Copy link
Contributor

@philiptaron philiptaron left a comment

Choose a reason for hiding this comment

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

Dang Silvan, I'm learning too much. This is definitely effortful in a way that's quite impressive.

.github/workflows/main.yml Show resolved Hide resolved
default.nix Show resolved Hide resolved
scripts/update-github-actions.sh Outdated Show resolved Hide resolved
scripts/update-github-actions.sh Outdated Show resolved Hide resolved
scripts/update-github-actions.sh Outdated Show resolved Hide resolved
scripts/update-github-actions.sh Show resolved Hide resolved
Makes the diff smaller for a future non-trivial update script
Using the dependabot CLI
Copy link
Contributor

@philiptaron philiptaron left a comment

Choose a reason for hiding this comment

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

🦺 👍🏻 👀

Looks good.

@philiptaron philiptaron merged commit 6d09601 into main Apr 10, 2024
2 checks passed
@philiptaron philiptaron deleted the github-action-updates branch April 10, 2024 20:20
@philiptaron
Copy link
Contributor

@philiptaron
Copy link
Contributor

Lazy derivation didn't work as expected?

@infinisil
Copy link
Member Author

infinisil commented Apr 10, 2024

Ohh it did work as expected, this is actually great because it shows that we relied on .version, which was kind of internal. I'll make a PR to explicitly expose it. Edit: #41

@infinisil
Copy link
Member Author

Just opened dependabot/cli#301 to hopefully have a better solution eventually :)

@infinisil
Copy link
Member Author

Nice: #42

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.

None yet

3 participants