-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
github context is not accessible from step.uses #895
Comments
Same issue occurs also for |
Currently branch name used in action address cannot be substituted with ${{ github.event.inputs.ref }} variable, because `github` context is not availible from step.uses. See: actions/runner#895 for more details. Using hardcoded branch name for now.
Currently branch name used in action address cannot be substituted with ${{ github.event.inputs.ref }} variable, because `github` context is not availible from step.uses. See: actions/runner#895 for more details. Using hardcoded branch name for now.
We don't support expression in those place, you need to checkout the repo to use local action.
|
Is there a reason why it is not supported? |
We want the YAML file readable at some level, so we don't open expressions for every part of the YAML file. You can make a feature request at https://github.jparrowsec.cnmunity/c/code-to-cloud/github-actions/41 The runner repo might not be a good place for this kind of question, it doesn't understand YAML at all, the service parses the YAML and validates against a defined schema. 😄 |
This looks to me as a pretty weak argumentation.
I find forums pretty bad place for feature requests, as the post on forums quickly gets lost and nobody follows up on those. There should be a bug tracker for that! This is why I opened it here. I have no idea which part of the software is responsible for yaml parsing, could you forward this to the right team/software component? |
@chrispat from product |
The original reason we didn't support it was so we could enforce the policies of the org when they limited which actions you could use. We have changed how the runner resolves actions so it we could support it now. However, you would get a runtime failure if you violated a policy rather than a queue time failure. For this particular scenario I don't see how it is different than referencing a repository local action via ./ |
Ok, for my particular use case using local action is enough, so if you want, you can close the issue. |
We want to have a security check of you containers implemented for every PR that is created. For that it is crucial to build the container in one job, push it into the registry and then pull and run some command in it. jobs:
security-check:
runs-on: ubuntu-latest
needs: build-main-test
steps:
#....
- uses: docker://eu.gcr.io/security-check:${{ env.GITHUB_SHA }}
with:
entrypoint: security-check How can we achieve this when we cannot use the variables in this context? |
If you try access a sibling action that you want to have at the same ref as the action being executed you need that expansion too. 😞 |
If we have a checkout action that sets a path relative to I've tried various things and haven't found a method that works. env:
GIT_CLONE_PATH: "${{ github.workspace }}\\${{ github.ref_name }}"
jobs:
test:
runs-on: self-hosted
steps:
- uses: actions/checkout@v3
with:
lfs: true
clean: false
path: "${{ env.GIT_CLONE_PATH }}"
# The following doesn't work because it's looking for actions.yml in ${{ github.workspace }}/.github/actions/CustomAction.
# We also can't set the working directory for uses.
- uses: ./.github/actions/CustomAction
# Ideally I can do something like this:
- uses: "${{ env.GIT_CLONE_PATH }}/.github/actions/CustomAction"
# Or something like this:
- uses: ./.github/actions/CustomAction
working-directory: "${{ env.GIT_CLONE_PATH }}" |
Try When using local actions the local action is indicated by the I do fear that the uses will not accept any I'd avoid using that ref name in check-paths. I guess there some dodging there of the self-hosted runner not cleaning up. |
Lets say I have two repos. Repo A has a workflow that calls Composite Action 1 in Repo B. Composite Action 1 calls Composite Action 2 in Repo B. The lack of availability of the In Composite Action 1, I want to have the following:
However, I can't because the My first instinct is to do this:
However, the
Instead, I have to hard code the reference to the nested composite action, which greatly complicates the development workflow for working on these shared actions. |
I've figured out a workaround using a composite action that generates and runs another composite action to call the desired action dynamically 😅 ... Give Given a step like so: - uses: actions/setup-node@v3
with:
node-version: 18 If you want your - uses: jenseng/dynamic-uses@v1
with:
# now you can use expressions 🥳
uses: actions/setup-node@${{ inputs.version }}
# the `with` needs to be converted to a valid json string
with: '{ "node-version": 18 }' |
@wheelerlaw this is my exact use case that I'm slamming my head against. Why is this not supported? I can hard code everything, but can't use github context to make it dynamic. Really under developed feature here guys. |
Agreed. I would love to have this feature so that we at our organization are able to port workflows across GitHub organizations 😞 |
In addition to the list of legit use cases pointed out above. One could structure a repo containing both reusable workflows and actions, and might want to guarantee the version of the actions used remains in sync with the reusable workflow, having access to |
This is exactly our use case, it's disappointing it isn't supported |
cannot use matrix to run actions dynamically use action See: actions/runner#895 (comment)
cannot use matrix to run actions dynamically use action See: actions/runner#895 (comment)
Why is this issue closed and not being actively worked on? This is a huge problem for testing new versions of actions that are nested deeply inside other actions. if action A uses action B uses action C, in order to test my changes in action C I have to make a branch in action B that points to my commit on action C, and likewise in A.. what a fucking mess that is. |
We are facing the exact same issue when trying to build unified actions & workflows for hundreds of repos within our orga. Having the github context available in |
Hi GitHub Actions Runner Maintainers! I do software development for the Department of Veterans Affairs. First, I want to say thank you for all the work you do to build this product that thousands of us use every day to get our work done! Regarding issue at hand, I'm also running into it! I have a chunk of work that's implemented in Repo A workflow A.1 that calls Repo B Action B.1, and then Action B.1 calls workflow B.2. As I make changes to workflow B.2 on my feature branch in repo B, I want to be able to iteratively test it by kicking off workflow A.1, in which I would like to be able to specify steps:
uses: my-org/repo-b/.github/actions/action-b-1@${{ inputs.repo-b-branch }} Important additional constraint: In my use case, I can't do the suggested solution above of just checking out the version of Please open this issue and work it into your roadmap. |
@mountHouli Does your department have an enterprise or special relationship that it can leverage to lean on github to get this feature moving again? I fear that posting requests like that here will just be ignored. If you have side channels that can be used to create "imaginative" motivation; I'm sure we would all be grateful. Otherwise perhaps #895 (comment) will solve your issue? |
Describe the bug
It is not possible to use
github
context injobs.<job_id>.steps[*].uses
.To Reproduce
create workflow which uses
github
context withinuses
:Expected behavior
github.repository
andgithub.sha
are substituted with correspoonding values.Runner Version and Platform
public runner
What's not working?
github
context variable substitutionJob Log Output
Runner and Worker's Diagnostic Logs
https://github.com/myci-actions/add-deb-repo/actions/runs/469160309
The text was updated successfully, but these errors were encountered: