heinrichreimer / action-github-changelog-generator

✏️ Automatically generate change log from your tags, issues, labels and pull requests on GitHub.
MIT License
127 stars 34 forks source link

addSections issue #3

Closed skyem-hca closed 3 years ago

skyem-hca commented 4 years ago

I've been unable to get addSections to work. I tried using the example input from the linked page, and tried manipulating it for yaml too with no success. I've always either gotten a 'Workflow is not valid: mapping was not expected' from Github, or /usr/local/bundle/gems/github_changelog_generator-1.15.0/lib/github_changelog_generator/generator/entry.rb:71:inrescue in parse_sections': There was a problem parsing your JSON string for sections: 416: unexpected token at '{"documentation":{"prefix":"**Documentation' (RuntimeError)` when I got it to parse the yaml.

Do you have any tips?

renehernandez commented 4 years ago

I forked the repo and ran it several times with debugging changes on my repo and it turns out the issue is with word splitting.

I enabled set -o xtrace on the entrypoint.sh script and with addSections in the action usage as follow:

addSections: '{"documentation":{"prefix":"**Documentation updates:**","labels":["documentation"]}}'

then the command that ends up being executed is:

github_changelog_generator --user renehernandez --project camp3 --token *** --add-sections '{"documentation":{"prefix":"**Documentation' 'updates:**","labels":["documentation"]}}' --issues --issues-wo-labels --pull-requests --pr-wo-labels --no-filter-by-milestone --no-author --unreleased --unreleased-label true --no-compare-link --no-verbose

Notice how an extra pair of single quotes gets added separating Documentation and updates word, making it an invalid json string.

It works fine if I just use Documentation instead of Documentation updates

renehernandez commented 4 years ago

Example here: https://github.com/renehernandez/camper/blob/master/.github/workflows/ci_changelog.yml#L26

browniebroke commented 4 years ago

I think it's the same issue I had with spaces in sections. I suggested a fix in #2 and I've been using it successfully in my projects since. You can see an example here:

https://github.com/browniebroke/django-codemod/blob/master/.github/workflows/changelog-generator.yml

corvis commented 3 years ago

I'm struggling from the same issue too. @heinrichreimer any chance you could review the proposed PR anytime soon?

heinrichreimer commented 3 years ago

Thanks for bringing this to my attention! I've now merged the bugfix. Thanks to @browniebroke! I've also updated this project to use the action itself, so that we should see issues earlier.

corvis commented 3 years ago

Perfect! Many thanks for the quick reaction and the super useful action.

heinrichreimer commented 3 years ago

I've now applied @browniebroke's fix to some other inputs as well. Hope I didn't miss one.