I’ve spent the last two days on trying to make something like this work. Am I nuts or is this unreasonably hard?
Similar to you, all I want to be able to do is define some behavior that runs only when someone does a Release, and for that behavior to know the name of the branch it is running against.
I managed to make the first part of that work on something like the 30th attempt with an unholy and somewhat ridiculous combination of setting environment variables in one step using a shell, and then using them in a different step as new environment variables, and then finally using THOSE in an if: clause. As far as I can’t tell you can’t do that at the job level, but you can make individual steps conditional.
But once I got that working, it turned out that the branch name was no longer available because now the reference is to the release, not to the branch.
Sorry I don’t have better answers. This is my first experience with GitHub actions and I was really hoping that it would make it easy to convince my team to walk away from Jenkins, but my experience so far is that nothing has seemed obvious or easy.
One of the biggest problems is that all of the supposed solutions come with restrictions on their context. I’m sure those restrictions are there for engineering reasons but this doesn’t feel designed – it feels hacked. Dear GitHub team, this forum is full of people who are trying to figure out an easy way to access basic information about the context in which their jobs are running, and to use those in conditional behavior. Personally, I’m going to have to fall back to running python scripts and just invoking those with Actions.