DEV Community

Discussion on: Manual trigger with Github Actions

Collapse
 
karfau profile image
Christian Bewernitz

Thx, even though I'll most likely not use the "star method", your article is a good reference collection regarding github action triggers.

Do you have a reference/example at hand how to write the condition to check if the stargazer is in the team of an org (or in a list of users?)

Collapse
 
sabderemane profile image
Sarah Abd • Edited

Thanks, my article hasn't vocation to deliver the best method and as I said, it's really hacky, but good to know and also there are other options.

I haven’t an example right now but you can easily do a step with the logic of checking if the user is part of a list of the users in the language you prefer.
Execute the file and save the result as variable and return a boolean if it's true or false. And the following steps will be conditioned according to the result.

Maybe this example can helps you :

name: Extract branch name
      id: extract_github
      run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"

In this case, in your workflow, you will be able to reuse the name of the branch if you want to do a step only on this branch :

if: steps.extract_github.outputs.branch == ’staging'