eclipse-csi / otterdog

OtterDog is a tool to manage GitHub organizations at scale using a configuration as code approach. It is actively used by the Eclipse Foundation to manage its numerous projects hosted on GitHub.
https://otterdog.readthedocs.org
Eclipse Public License 2.0
23 stars 3 forks source link

chore: expand user inputs outside of bash and javascript #266

Closed mbarbero closed 3 weeks ago

mbarbero commented 3 weeks ago

While I don't see any issue in current code, it's better practice to place the expression in environment variable before the start of the script.

netomi commented 3 weeks ago

the change LGTM. Something that I learned the hard way is that input variables are not accessible anywhere inside a workflow file as crazy as that sounds (see https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs#context-availability to get a list of places where each context is available).

So inputs should be available at jobs..steps.env so should be fine.

While looking at change, I also see that this can be further shortened. Instead of github.event.inputs you could use inputs directly afaict.

EDIT: looking at the referenced documentation, they must have made some changes, I am 100% sure that you could not use inputs in the top-level env element.

mbarbero commented 3 weeks ago

Was following https://docs.github.com/en/actions/security-for-github-actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable, but if you say that inputs are treated differently, then let's just abandon this change.

netomi commented 3 weeks ago

thing seem to have changed, now inputs seem to be available everywhere it seems, so its good.

mbarbero commented 3 weeks ago

thing seem to have changed, now inputs seem to be available everywhere it seems, so its good.

gotcha, I understood the opposite 🤦