Skip to content

feat: allow configuring config path#88

Open
rubda wants to merge 1 commit into
Redocly:mainfrom
rubda:configurable-config-path
Open

feat: allow configuring config path#88
rubda wants to merge 1 commit into
Redocly:mainfrom
rubda:configurable-config-path

Conversation

@rubda
Copy link
Copy Markdown

@rubda rubda commented Aug 6, 2025

What/Why/How?

What: Added optional configPath input parameter to allow specifying custom path to Redocly configuration file.

Why: Currently this action assumes that the Redocly configuration lives in the root of wherever it is being run. That might not always be the case, thus I'm adding this option to be able to set where the config lives.

How: Extended the action inputs, updated parsing logic to handle the new parameter, and modified getRedoclyConfig() to pass the custom path to loadConfig() from @redocly/openapi-core.

Reference

  • Uses existing loadConfig({ configPath }) API from @redocly/openapi-core
  • Maintains backward compatibility - when no config parameter is provided, uses default discovery behavior

Testing

  • Added unit tests for parseInputData() with and without custom config parameter
  • Added unit tests for getRedoclyConfig() with default and custom config paths
  • Mocked loadConfig to avoid file system dependencies in tests
  • All existing tests continue to pass
  • Linting and formatting checks pass

Screenshots / Video (optional)

N/A

Additional context

Usage example:

- uses: your-action
  with:
    organization: your-org
    project: your-project
    configPath: 'configs/custom-redocly.yaml'  # Optional - new parameter
    files: 'docs/'
    mountPath: '/docs'

Currently this action assumes that the Redocly configuration lives in the root of wherever it is being run.
That might not always be the case, thus I'm adding this option to be able to set where the config lives.
@rubda rubda marked this pull request as ready for review August 6, 2025 11:54
@SmoliyY
Copy link
Copy Markdown
Contributor

SmoliyY commented Aug 12, 2025

Hi @rubda! Thank you for your contribution. Currently push action does not use the config during push so there is no reason to provide a path for config. However this is good catch! In future if there will be such need we definitely should provide such possibility!

@rubda
Copy link
Copy Markdown
Author

rubda commented Aug 12, 2025

Hi @SmoliyY! Thanks for having a look, regarding the below. How is this action supposed to work if the redocly.yaml file does not live in the root of the repository? In GitHub Actions, working-directory only works with run: steps, not with uses: steps, because prebuilt actions don't inherit the runner's working directory setting AFAIK and thus it isn't an option in this case.

Why: Currently this action assumes that the Redocly configuration lives in the root of wherever it is being run. That might not always be the case, thus I'm adding this option to be able to set where the config lives.

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

Successfully merging this pull request may close these issues.

2 participants