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

Error: Cannot read properties of undefined (reading 'replace') #457

Open
tysonnero-ccm opened this issue Apr 12, 2024 · 6 comments
Open

Comments

@tysonnero-ccm
Copy link

Hi!

I'm getting the following error when running this action from a workflow:
Error: Cannot read properties of undefined (reading 'replace')

I'm not getting any other specific details, so I'm not sure what the exact issue may by.

Here is an example of what is being passed to the action:

with:
    sourceFile: .github/actions/build/action.yml
    readme: .github/actions/build/README.md
    includeNameHeader: true
    tocLevel: 1
    lineBreaks: LF

The source and readme values are pointing to actions within the repository that are being fed in from tj-actions/changed-files. I am able to cat both of these files in a previous step and see their contents. Is this action expecting a different path?

Thanks for any guidance!

@tysonnero-ccm
Copy link
Author

I think I know what's happening...

When the action is looking for sourceFile here, it's using the input being passed in, but the tag in the file itself has a different source value as it was generate locally. These need to match.

@tysonnero-ccm
Copy link
Author

tysonnero-ccm commented Apr 17, 2024

Didn't seem to do the trick...

Here's my arguments to the action:

with:
    sourceFile: .github/actions/api/build-app/action.yml
    readme: .github/actions/api/build-app/README.md
    includeNameHeader: true
    tocLevel: 1
    lineBreaks: LF
    lineBreaks: LF

I've updated the README to look something like this...

<!-- action-docs-header source=".github/actions/api/build-app/action.yml" -->
# Build Application
<!-- action-docs-header source=".github/actions/api/build-app/action.yml" -->
<!-- action-docs-description source=".github/actions/api/build-app/action.yml" -->
## Description

Builds and runs tests for app
<!-- action-docs-description source=".github/actions/api/build-app/action.yml" -->

I can run action-docs locally against these files with the same paths and it works.

Is there any extra debugging I can enable to figure out the issue?

@npalm
Copy link
Owner

npalm commented Apr 18, 2024

Thanks for creating the issue, need to find some time to dig in.

@ox0
Copy link

ox0 commented Apr 30, 2024

Run npalm/action-docs-action@main
  with:
    readme: docs/actions/ci-deploy-eks.README
    sourceFile: .github/workflows/ci-deploy-eks.yaml
    includeNameHeader: true
    tocLevel: 2
    lineBreaks: LF
Error: Cannot read properties of undefined (reading 'replace')

We got the same error as this issue raised, any fix or work-around we may have, please ?

@byangtri
Copy link

% action-docs --update-readme
     _       ____   _____   ___    ___    _   _           ____     ___     ____   ____  
    / \     / ___| |_   _| |_ _|  / _ \  | \ | |         |  _ \   / _ \   / ___| / ___| 
   / _ \   | |       | |    | |  | | | | |  \| |  _____  | | | | | | | | | |     \___ \ 
  / ___ \  | |___    | |    | |  | |_| | | |\  | |_____| | |_| | | |_| | | |___   ___) |
 /_/   \_\  \____|   |_|   |___|  \___/  |_| \_|         |____/   \___/   \____| |____/ 
                                                                                        
Cannot read properties of undefined (reading 'replace')

I also received the same error in my local when running action-docs cli command

@tcushman
Copy link

I have been receiving this error for an action and was able to track down the cause to an input parameter missing a description field. There could be a variety of causes all producing the same terse error message, but by removing sections of the action YAML I narrowed the problem down to an input, then by bisecting the inputs I found which one was causing the failure.

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

5 participants