feat: make terra plan write diff to github PR
Introduce postDiffToGitHubSnippet for unified diff posting and update kubectl.nix and terra.nix
-
Add
postDiffToGitHubSnippet:- Created a reusable snippet that handles posting unified diffs to GitHub PR comments using the
ghCLI. - Manages existing comments by updating them or creates new ones if necessary.
- Created a reusable snippet that handles posting unified diffs to GitHub PR comments using the
-
Update
kubectl.nix:- Replaced inline diff posting logic with the new
postDiffToGitHubSnippet.
- Replaced inline diff posting logic with the new
-
Modify
terra.nix:- Integrated
postDiffToGitHubSnippetinto theplancommand within thewrapfunction. - Exported
TF_VAR_fragmentandTF_VAR_fragmentRelPathfor use in Terraform configurations. - Changed the Terraform working directory to
$PRJ_ROOT/.cache/${fragmentRelPath}/.tffor better organization.
- Integrated
Could you take it over and drive it over the finish line, especially with some real testing towards the end?
Currently works!
But i'm still not comfortable with --edit-last option from a monorepo point of view. Different terra plans overwrite between them. I will back with an alternative.
@oneingan Nice! I'm noticing some movement. Go for it! :handshake:
i make it append multiple plans in a sticky PR comment, also passthru some cell info in TF_VAR. I move the staging area to a different directory than nix and use full fragment path to avoid conflicts.
I thought is ready for review @blaggacao
I (finally) made sure tests run on main: https://github.com/divnix/std/actions/runs/11517292880 — can you rebase?
Can you give some context on the CI failure?
It might be an accidental, unrelated failure. But I lack a bit of context on that possibility.
If that's the case, I'd have to apologize and fix that first.
Let's ignore the Mac failure, seems pretty much unrelated. I'm glad that linux is green now, thank you!
~~Please tackle any further fixes in follow up PRs, in case it's necessary. Merging. 🚀~~
Hm, the nvfetcher change, adding '''' looks quite unrelated, could you drop that?
sorry i was trying to catch the macos fail, i will revert last commits then