github-tools / github-release-notes

Node module to create a release or a changelog from a tag and uses issues or commits to creating the release notes.
https://github-tools.github.io/github-release-notes/
GNU General Public License v3.0
883 stars 324 forks source link

gren init with token option #253

Open dlsrb6342 opened 4 years ago

dlsrb6342 commented 4 years ago

When run gren init --token=******, it doesn't work well. I got following error log.

Can't find GREN_GITHUB_TOKEN. Please configure your environment
See https://github.com/github-tools/github-release-notes#setup

Can't I use gren init with token option?

yansheng836 commented 4 years ago

Maybe you are right, gren init doesn't have this option. My try:

gren init --token=****
error: unknown option `--token'

For another way, just like the error log, you should add the token to ~/.bash_profile (or ~/.zshrc). see https://github.com/github-tools/github-release-notes#setup.

If you've already done it.gren init is ok.

dlsrb6342 commented 4 years ago

Yes I know that. If I add environment variable(GREN_GITHUB_TOKEN), it works well. Actually, I want to use all gren command with --token=*** option.

alexcanessa commented 4 years ago

The gren init is just to create the configuration file, which you can use together with the --token option.

You should run gren release|changelog --token instead?

dlsrb6342 commented 4 years ago

Then, if I don't set GREN_GITHUB_TOKEN variable, Can't I use gren init?

alexcanessa commented 4 years ago

You can:

$ gren init

🤖 : Hello, I'm going to ask a couple of questions, to set gren up!

? What type of APIs do you need? Normal
? Where shall I get the informations from? Issues (Time based)
? Do you want to add a prefix to release titles? e.g. v
? Do you want to only include issues/prs that belong to a milestone? No
? Do you want to ignore tags containing certain words? No
? Do you want to group your notes? No
? What file name do you want for your changelog? CHANGELOG.md
? Which extension would you like for your file? .grenrc.yml

Great news! Your .grenrc.yml as been created!

  $ cat .grenrc.yml
---
  dataSource: "issues"
  prefix: ""
  onlyMilestones: false
  groupBy: false
  changelogFilename: "CHANGELOG.md"

And then run

$ gren release --token=xyz
dlsrb6342 commented 4 years ago

image Without GREN_GITHUB_TOKEN environment variable, I got error.

alexcanessa commented 4 years ago

Oh! Weird. Bug then 😅

dlsrb6342 commented 4 years ago

Yes. And also, I think if we can set token value in config file, it would be better to use.

alexcanessa commented 4 years ago

The token shouldn't be saved in the config file as could be committed and not secure.