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

Cannot read property 'commit' of undefined #1

Open
Blueforcer opened this issue Jan 18, 2021 · 9 comments
Open

Cannot read property 'commit' of undefined #1

Blueforcer opened this issue Jan 18, 2021 · 9 comments

Comments

@Blueforcer
Copy link

Hello im very new to github actions and want to use your changelog generator.
Unfortunally i get this error:

Run Helmisek/[email protected]
fetch all tags in repository...
fetched all 1 tags in repository.
sorted tags by semver.
showing up to 10 last tags...
tag 2021.1.18.2345
fetch all releases...
fetched all 1 releases.
current release index: -1
Error: TypeError: Cannot read property 'commit' of undefined

What does it means?

Thanks in advance

@quant-eagle
Copy link
Owner

quant-eagle commented Jan 18, 2021

Hello, thanks for reporting the issue.

Can you please post your configuration for this action too?

It seems that the action wasn't able to fetch any commits. And also the range is quite off as the current release index shouldn't be -1.

@Blueforcer
Copy link
Author

Blueforcer commented Jan 18, 2021

sure,

      - name: Changelog generation step
        uses: Helmisek/[email protected]
        id: changelog-generator
        with:
          repo-token: ${{ secrets.GITHUB_TOKEN }}
          commit-types: "fix:Bug Fixes,feat:Features,refactor:Refactoring"
          current-tag: ${{ env.PACKET_VERSION }}
      - name: Print version
        run: echo ${{ env.PACKET_VERSION }}
      - name: Print changelog
        run: echo "${{steps.changelog-generator.outputs.changelog}}"

im not sure about the "current-tag". right now im using a new tag wich is generated in the same workflow for release upload

@quant-eagle
Copy link
Owner

Thanks, the configuration itself seems fine.

Are you sure the newly generated tag is pushed before the action is called and you can see it in the log of the action?

Or if the env value provides a proper tag value? The ´current-tag´ field is used to select a proper tag from the list.

I was able to reproduce your issue by providing a non-existent tag to the ’current-tag´ field.

Anyway this is a good edge case to handle.

@quant-eagle
Copy link
Owner

quant-eagle commented Jan 18, 2021

Alternatively, you could just remove the ´current-tag´ field.

This would tell the action to use the first tag available. That should be the same as the first tag you get when calling ´git tag´ in terminal.

@Blueforcer
Copy link
Author

ah ok. Now i understand. the tag doesnt exists at this time, because i want to have the fresh changelog file inside my release package.
I think i need to rethink my workflow.
Thanks for that hint

i tried to remove the tag.

Run Helmisek/[email protected]
fetch all tags in repository...
fetched all 1 tags in repository.
sorted tags by semver.
showing up to 10 last tags...
tag 2021.1.18.2345
fetch all releases...
fetched all 1 releases.
current release index: 0
current release sha: "e9b6e3be31f0082e1b03f38fa0fc56b19d125e34"
previous release index: -1
previous release sha: "0b2a0a019d5926cb19e74c195d55c0930725cf09"
fetch commit range...
requested commits between "0b2a0a019d5926cb19e74c195d55c0930725cf09" and "e9b6e3be31f0082e1b03f38fa0fc56b19d125e34" fetched. (99)
retrieveing changelog mapping
Error: Error: ENOENT: no such file or directory, open 'CHANGELOG.tpl.md'

does this error also belongs to my wrong workflow? Because I dont set a template

@quant-eagle
Copy link
Owner

quant-eagle commented Jan 19, 2021

OK, great we figured that out.

Unfortunately this is based on the API, so you have to have it pushed already.

I was also thinking of preparing an integration which would allow you to use this action which would work with the git history in the local repo.

It'd be a great enhancement for use cases like yours.

Also about the error you're getting, that's definitely the error on side of the action.

For me it works well without the path specified and it falls back to the default one. So I will have to investigate why this happened to you.

Thanks for reporting these! ✅

I am going to focus on handling these edge cases and errors for the next version so the integration is more seamless and more informative in the future.

@Blueforcer
Copy link
Author

Thank you very much for your help!
Have a nice day

@quant-eagle
Copy link
Owner

You are welcome. I will close this issue once the new release is out and fixes these problems.

You too have a nice day.

@hobbsh
Copy link

hobbsh commented May 6, 2021

I am using this as a workaround for the changelog template not being found:

       - name: Dump changelog template
         run: |
           echo '###CHANGELOG' > CHANGELOG.tpl.md
           echo 'VERSION: {{versionName}} | Created: {{date}}' >> CHANGELOG.tpl.md
           echo '{{.SECTION}}### $title{{.SECTION}} {{.COMMITS}}- $commit{{.COMMITS}}' >> CHANGELOG.tpl.md

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

3 participants