Reuse workflow: dynamic branch reference (github.ref_name) #5707
-
Hello, When using reuse workflow, we need to mention the branch to reference the yml workflow. is working: This not working when I use the predefined variable (github.ref_name) to dynamcally ref the branch: uses: Company/myRepo/.github/workflows/wf.yml@${{github.ref_name}} Is someone tried to make this working ? Regards |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Perhaps this article is helpful? This is not specifically bicep related, so I am not sure this is the right place for this question. |
Beta Was this translation helpful? Give feedback.
-
I don't think this is possible now. The main problem is that GitHub does the validation of your workflow files before any of the context or environment variables is available. and you will get an error saying:
If you think about it, it makes sense to force this kind of versioning. |
Beta Was this translation helpful? Give feedback.
-
I have a use case for this in developing Actions themselves: running CI against the current branch of a PR for testing the action itself. Would be really nice if we could use the branch dynamically. |
Beta Was this translation helpful? Give feedback.
Perhaps this article is helpful?
This is not specifically bicep related, so I am not sure this is the right place for this question.
https://stackoverflow.com/questions/60300169/how-to-get-branch-name-on-github-action#:~:text=GITHUB_REF%20always%20has%20a%20value%2C%20but%20the%20value,PR%2C%20it%20is%20the%20PR%20branch%20name%20%28refs%2Fpull%2F123%2Fmerge%29.