Skip to content
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

Local composite actions always relative to top level repository #1348

Open
nyarly opened this issue Sep 16, 2021 · 3 comments · May be fixed by #1684
Open

Local composite actions always relative to top level repository #1348

nyarly opened this issue Sep 16, 2021 · 3 comments · May be fixed by #1684
Labels
bug Something isn't working Runner Bug Bug fix scope to the runner

Comments

@nyarly
Copy link

nyarly commented Sep 16, 2021

Describe the bug

I'm building a set of actions for my organization, and I would like to re-use common sections as composite actions. This appears to be the motivating case around #646, and it certainly suits my needs.

However: I have a pattern like:

main repo

- uses: actions/checkout@v2-beta # check out your code
- uses: actions/checkout@v2-beta # check out the actions repo
  with:
    repository: my-org/github-actions
    ref: refs/tags/v1
    path: github-actions
- name: Run the private action
  uses: ./github-actions/build-em-all

then in my-org/github-actions /build-em-all/action.yml

#...
- uses: ./do-tedious-setup

My dilemma here is that the above won't work - the action is looked up relative the the consumer's workspace; so it should be - uses: ./github-actions/do-tedious-setup - but that's entirely dependent on the checkout in the consumer! The actions library has to expect that it's checked out in the right directory, which itself imposes a restriction on the file structure of consuming projects.

Even if I were to parameterize the checkout location, the uses field (probably rightfully) doesn't get any contexts to work from, so I can't deliver the input.

For the moment, I'm settling on documenting the requirement and hoping it doesn't cause a problem.

Expected behavior

It'd be great if actions were looked up with a Bash style PATH behavior and that a workflow could append items to the lookup list.

Runner Version and Platform

Version of your runner? Github hosted ubuntu-latest

@nyarly nyarly added the bug Something isn't working label Sep 16, 2021
@thboop
Copy link
Collaborator

thboop commented Sep 16, 2021

Hey @nyarly , we expose a variable in the github context ${{github.action_path}} that contains the path to where the action is located. You can use that in relation to your subpath to accomplish what you are trying to do if i'm understanding your use case correctly, can you try that?

There are some more docs located here

We don't support these contexts in a uses statement, which appears to be the issue here. We could support these contexts, which would allow you to do something like uses: ${{github.action_path}}/do-tedious-setup which would help this use case, but I don't think we have a dynamic way of doing this outside of your suggested workaround right now. Thanks for reporting this.

@ricCap
Copy link

ricCap commented Feb 13, 2022

@thboop when you find the time, could you please have a look at #1684?
@nyarly, does #1684 covers your use case?

Thanks both

@nikola-jokic nikola-jokic added the Runner Bug Bug fix scope to the runner label Apr 4, 2022
tonisojandu-sympower added a commit to sympower/sympower-actions that referenced this issue Oct 24, 2023
This is to avoid self-reference release before the version commit exists and is tagged.
Self-reference would cause a Renovate loop in Sympower Actions.

Relative references are not supported yet:
actions/runner#1348
actions/runner#1684

This PR has been on the shelf since February.  [Comment](actions/runner#1684 (comment)) from @nyarly from August suggests that this feature could compromise the feature set that is reserved for Enterprise users, so there is no confidence that it will be merged.

Tested the changes here:
https://github.com/sympower/msa-observability/actions/runs/6626012294
https://github.com/sympower/msa-observability/actions/runs/6626046945
@Waterstraal
Copy link

Running into this exact same issue right now.

I want to share common Github Actions in my org. For composite actions that use other tasks with a relative path, this breaks because it will look for the task in the consuming repository and not where the shared action is stored. I would consider this a bug.

Can this be fixed on Github's side @thboop?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Runner Bug Bug fix scope to the runner
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants