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_configuration_path insert current working directory before absolute path #47

Open
GMZwinge opened this issue Feb 28, 2024 · 2 comments

Comments

@GMZwinge
Copy link

I am trying to encapsulate the config file with my own shared action that calls your action. My shared action includes my config file that is passes to your action. That way, multiple repos can call my shared action to check PR title consistently.

For this, I would like my action to call your action like this:

name: Check PR title
description: Check that the PR title conforms to the Contribution Guidelines embedded in this action.
runs:
  using: composite
  steps:
    - uses: thehanimo/[email protected]
      with:
        GITHUB_TOKEN: ${{ github.token }}
        local_configuration_path: ${{ github.action_path }}/pr-title-checker-config.json

where pr-title-checker-config.json is in the same location as my action.yaml. The action thehanimo/pr-title-checker seems to prefix the local_configuration_path with the path to the folder of the workflow calling my shared action. The output is:

Using local config file /home/runner/_work/_actions/<ActionOwner>/<ActionRepo>/<GitRef>/.github/actions/pr-title-check/pr-title-checker-config.json
Error: Couldn't retrieve or parse the config file specified - Error: ENOENT: no such file or directory, open
'/home/runner/_work/<WorkflowRepo>/<WorkflowRepo>/home/runner/_work/_actions/<ActionOwner>/<ActionRepo>/<GitRef>/.github/actions/pr-title-check/pr-title-checker-config.json'

The workaround is to use this:

        local_configuration_path: ../../../../..${{ github.action_path }}/pr-title-checker-config.json
@GMZwinge GMZwinge changed the title local_configuration_path adds pwd to absolute path local_configuration_path insert current working directory before absolute path Feb 28, 2024
@thehanimo
Copy link
Owner

Just to make sure I understand this correctly, the config file you want to use does not live in the repo that calls the action, correct? The repo calls your action, whose repo contains the config? How about using a remote config link or a GitHub repo config if it is private?

@GMZwinge
Copy link
Author

@thehanimo That is correct. The repo of the workflow that calls my action does not contain the config file. The config file lives in the repo containing my called action that calls your action. A remote config link or a GitHub repo config would probably works, but it's more complicated and it defeats the purpose of ${{ github.action_path }} that can be used to access files located in the same repository as the action according to github.action_path in github context.

To not break backward compatibility, there could be a new input named for example absolute_configuration_path that to handle the use of ${{ github.action_path }}.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants