News for hackers. Stuff that matters.
Re:GitHub Actions could be so much better by joshstrange on Friday September 22, 2023 @11:54AM (#37613643)
I couldn't agree more with the pain of debugging a GH Actions run. The /only/ tool you have is the ability to re-run with debug on. That's it. I have so many "trash" commits trying to fix or debug a pipeline and so much of it's just throwing stuff at the wall to see if it sticks.

Very basic things, like having reusable logic, is needlessly complex or poorly documented. Once I figured out how to do it it was fairly easy but GitHub's docs were terrible for this. They made it seem like I had to publish an action to get any reusability or put it in a different repo. Turns out you can create new yaml files with reusable logic but make sure you put them in the root of the workflows folder or they won't work, go figure.

It's just incredibly painful to work on GH Actions but once you have them working they are such a joy. I really wish there was some kind of local runner or way to test your actions before committing and pushing.

Re:GitHub Actions could be so much better by TeeMassive on Friday September 22, 2023 @12:00PM (#37613728)
I've tried running the GitHub runner image (or maybe an imitation) and it was really painful to setup and to get some things working. I just let it go after 2 days.

And it's not just Github. The others big CI platform are not really better in terms of workflow and integration.

Now I just script everything to the maximum.

Re:GitHub Actions could be so much better by giobox on Friday September 22, 2023 @12:42PM (#37614263)
> I have so many "trash" commits trying to fix or debug a pipeline and so much of it's just throwing stuff at the wall to see if it sticks.

One tool is to use draft PRs for this - you can run changes to your action YAML from the draft PR. When you are happy just squash the commits as you see fit on a "real" PR to merge the changes in without the mess.

I've found draft PRs for debugging/developing GH action logic to be pretty reasonable.

Re:GitHub Actions could be so much better by lambda_garden on Friday September 22, 2023 @01:27PM (#37614909)
Since some action depend on the branch / tag you are on this is not always possible.
Re:GitHub Actions could be so much better by secret-noun on Friday September 22, 2023 @03:29PM (#37616583)
Indeed. I have sometimes made release workflows, hardcoded to the main branch.

You don't want to experiment too much on main because it dirties your commit history with 20 "Fix typo"-esque commits.

Or, if you try to emulate the main branch with a fake main branch (so you can squash it later), you're still going to have some test commits when do the find-replace back to main.

Neither are great.

Re:GitHub Actions could be so much better by mook on Saturday September 23, 2023 @03:11AM (#37621236)
Sometimes forking and using the main branch on the fork (or tags and releases) can help. And if you're on a team, nobody else needs to be aware of the noise that is you throwing trivial changes at the wall.

It gets painful if there are things you've only got on the main repo (e.g. custom runners, credentials, etc.) though.

Re:GitHub Actions could be so much better by andix on Friday September 22, 2023 @12:42PM (#37614268)
If I'm fixing CI I always put it on a feature branch and do a squash merge once I'm done. Because it's never just one quick fix, it's always 3-10 commits.
Re:GitHub Actions could be so much better by kitallis on Friday September 22, 2023 @02:06PM (#37615457)
> If I'm fixing CI I always put it on a feature branch and do a squash merge once I'm done. Because it's never just one quick fix, it's always 3-10 commits.

The problem is GA also does not allow you to commit a new workflow in a branch. It must first exist on your primary branch and then you may tweak it in another.

Re:GitHub Actions could be so much better by devoutsalsa on Saturday September 23, 2023 @07:01AM (#37622119)
If I have to commit several trash commits, I’m happy to squash locally and then do

    git push —force-with-lease origin main
Re:GitHub Actions could be so much better by andix on Saturday September 23, 2023 @12:32PM (#37624777)
Not cool if you work in a bigger team. Especially if there are some people that are not super experienced with git, and have no idea how to fix that locally.

But if you're working alone or in a smaller team, that's perfectly fine.

Re:GitHub Actions could be so much better by pid-1 on Friday September 22, 2023 @12:53PM (#37614418)
If only competitors could do better...

https://gitlab.com/gitlab-org/gitlab-runner/-/issues/2797

Re:GitHub Actions could be so much better by hv42 on Friday September 22, 2023 @05:22PM (#37617948)
yeah... https://github.com/firecow/gitlab-ci-local is a good workaround but should be built-in. How do developers at GitLab/Github debug their workflows?
Re:GitHub Actions could be so much better by hahn-kev on Friday September 22, 2023 @01:07PM (#37614610)
Check this out. It doesn't do everything but it's decent https://github.com/nektos/act
Re:GitHub Actions could be so much better by vladaionescu on Friday September 22, 2023 @01:55PM (#37615318)
This is the main reason we built Earthly: run your builds locally, and get consistency with the CI.