Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Copilot Lvl 3
Message 1 of 5

Usage of expressions and contexts in `uses` clause

Solved! Go to Solution.

I've got a use case where I want to test my action in an example workflow.
This works out great for me with hardcoded values in the `uses` clause. But it would be much more elegant to be able to use context variables like `github.repository` in the `uses` clause to be fork agnostic.

Something like this:

...
        uses: "${{ github.repository }}@master"
...


In my case I test a fork of a Github Repo. This means the root of my fork has another repository name than I do.
So it'll be great if this repository could be resolved dynamically by using the github context.

This is currently not possible and ends with:

### ERRORED 11:55:40Z

- Your workflow file was invalid: The pipeline is not valid. .github/workflows/gpr.yaml (Line: 14, Col: 13): Unrecognized named-value: 'github'. Located at position 1 within expression: github.repository
4 Replies
Solution
Pilot Lvl 2
Message 2 of 5

Re: Usage of expressions and contexts in `uses` clause

You can use path as argument for `uses`, so this should do the trick

- uses: ./
Highlighted
Copilot Lvl 3
Message 3 of 5

Re: Usage of expressions and contexts in `uses` clause

Thank you very much. This did the trick. Kudos to you :-D

Highlighted
GitHub Staff
Message 4 of 5

Re: Usage of expressions and contexts in `uses` clause

For a bit more color.  Because we have the settings where a repo or org owner can specify if they want third party actions or not we need to be able to resolve the full list of referenced actions before we start the workflow.  If we enabled expressions in the uses section that would not be possible until runtime and we would potentially get hours into a job before it failed due to this policy.

Highlighted
Copilot Lvl 3
Message 5 of 5

Re: Usage of expressions and contexts in `uses` clause

Thank you for this explanation