Work with GitHub Actions in Your Terminal with GitHub CLI
github.blog
github.blog
With Travis and now GH Actions I find the fastest way to develop is to just push countless commits and incrementally develop my work flow in a live-ish way while asking peers to ignore the email spam on failures.
It felt so wrong and amateur and kind of embarrassing.
- if ${{ github.event_name == 'why do you think this is acceptable?" }}
run:|
echo "I need programmatic CI no matter how much you think I don't"
Just let us write our entire pipelines in typescript. People are already using Actions for bitcoin mining, hosting porn, or whatever - if I can do arbitrary shell stuff you're not making my life easier by putting it behind a yaml DSL pretending to be "no code."If it were just typescript with a reasonable library we could run and debug it locally without jumping through hoops.
/rant
The issue is not really the significant indentation of YAML, it is more of the ambiguity of the syntax plus the fact that YAML is a serialization format so it doesn't have many ways to reduce repetition. Now those issues coupled with the significant indentation makes YAML a mess, but those issues doesn't exist in Python.
Once it's working locally I push up and it's usually only a commit or two away from working.
[0] - https://docs.gitlab.com/ee/ci/quick_start/#ensure-you-have-r...
[1] - https://medium.com/@umutuluer/how-to-test-gitlab-ci-locally-...
I agree with the other comments that CircleCI is my high-bar for "how can a sane person run the build locally?" because I also agree with the other comments that "act" is handy, but only for the most trivial of hello-world builds, and `gitlab-runner exec` is a cruel joke
I eventually gave up and have been running Actions on GitHub from a branch, merging into the main one once it works.
It's sisyphean.
* https://github.com/marketplace/actions/debugging-with-tmate
For my private projects, I just make it rain with minor incremental improvements, and once it is green, I rebase and squash.
For shared/OS projects, I'd rather fork it and then work on my fork, so I don't trigger emails or other webhooks.
I think they need to add some way for users to be able to ssh into the worker. Maybe each time an action step fails you have 5 mins to ssh into the container and inspect what’s going on.
If you run a local self-hosted runner, point your workflow at it, and trigger it (push/etc), then the job bounces from GitHub's backend over to your local runner, where you can then poke / prod / trace its execution.
It's not quite as "safe" — you don't get to test the workflow in advance of deploying it, but rather have to test it by deploying it. But it's still pretty useful for debugging. You can e.g. set environment variables on the runner itself, that then propagate into the job, to see how they affect the job. Or change stuff in the runner's user's home directory until the job works, to figure out what the job needs there, rather than deploying over and over with different "tweak this file or that" steps.
[1]: https://github.com/mxschmitt/action-tmate [2]: https://github.com/nektos/act
workflow_dispatch:
inputs:
debug_enabled:
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false
Then under the job steps, make the debug step conditional on that optional flag: # Enable tmate debugging of manually-triggered workflows if the input option was provided
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }}
You then can just trigger the build on the required branch, setting debug_enabled to true and voila.Edit: but agree the CircleCI interface is nicer where you can just run a debug build with ssh access directly.
I made https://github.com/nelsonjchen/reverse-rdp-windows-github-ac... for the Windows runners.
Just add continue on error to the failing step and use temporarily use these kinds of tools in the next step(s).
Oh and their interface is a `curl | sh` that execs whatever happens to be lying around in `/tmp/tunshell/client`. I guess* that is probably fine on a single-user system but I prefer not to run binaries that just about every process on my system can write to.
https://lets.tunshell.com/init.sh
Edit: I filed a bug https://github.com/TimeToogo/tunshell/issues/19
Most of these services run your workload inside a container, so it's not even a single-user system; it's an ephemeral system. It's like anything's going to be there other than the base image + what you put there.
But yeah, SSHing in is great. I miss that from Circle using GL & GH.
This is especially troublesome considering that some actions only take effect once you have merged them into master.
So in order to develop an action that is using the on "delete" hook you need to disable CI on master, push your workflow to master, renable CI on master, switch to your dev branch and push a bunch of commits while iterating on your workflow.
https://docs.github.com/en/actions/reference/events-that-tri...
Github what the fuck.
Don't even get me started on the "master" -> "default" name change... "master" in the git context isn't even being used in the "master / slave" sense.
Spend less time virtue signaling and improve your horrible CI and maybe I will consider bringing my projects back.
For those of you who are going to recommend I try the "act" library, I have, and after hours of debugging esoteric errors I just gave up.
This is probably the first time a proprietary Microsoft product *for developers* has had such huge popularity, even with many open source developers!