rhysd / changelog-from-release

Simple changelog generator from GitHub releases
https://github.com/rhysd/changelog-from-release/blob/master/CHANGELOG.md
MIT License
83 stars 14 forks source link

404 error when trying to use as GitHub Action on private repo #4

Closed DavidCannon closed 3 years ago

DavidCannon commented 3 years ago

Not sure if this comment was being seen on a closed issue:

https://github.com/rhysd/changelog-from-release/issues/1

I'm experiencing the same error as the OP when trying to use your tool as a GitHub Action on my private repo. I've setup a personal access token with repo permissions. I then added a new secret in my repo settings titled 'secrets.ACTIONS_TOKEN' with that personal access token as the value. But when I post a release and the action runs, it fails on this step:

Run rhysd/changelog-from-release/action@v2

With the following...

Run rhysd/changelog-from-release/action@v2
/usr/bin/docker run --name e4032e435f149b4c569e828c56674284ca_986d31 --label 5588e4 --workdir /github/workspace --rm -e INPUT_FILE -e INPUT_GITHUB-TOKEN -e INPUT_VERSION -e INPUT_COMMIT -e INPUT_PUSH -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/<repo>":"/github/workspace" <id>
changelog-from-release version: v2.2.0
+ GITHUB_TOKEN= /changelog-from-release
Error: Cannot get releases from repository <repo> via GitHub API: GET https://api.github.com/repos/<repo>/releases: 404 Not Found []

Any help you can give would be greatly appreciated. Your action is exactly what I was wanting, if I can just get it to work. πŸ˜ƒ

Originally posted by @DavidCannon in https://github.com/rhysd/changelog-from-release/issues/1#issuecomment-782348173

DavidCannon commented 3 years ago

@rhysd Just wanted to make sure this reached you. Thanks for any help you can give to make this work.

bnzo commented 3 years ago

Hey @DavidCannon, I was facing the same issue, same settings. I found a way to fix it with the following action. No need to setup a personal access token in my case. Hope it will work for you:

      - uses: rhysd/changelog-from-release/action@v2
        with:
          file: CHANGELOG.md
          github-token: ${{ secrets.GITHUB_TOKEN}}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}}

@rhysd this is a workaround as this generates the following warning:

Unexpected input(s) 'GITHUB_TOKEN', valid inputs are ['entryPoint', 'args', 'github-token', 'file', 'version', 'commit', 'push']

Hope that helps.

DavidCannon commented 3 years ago

Hey @DavidCannon, I was facing the same issue, same settings. I found a way to fix it with the following action. No need to setup a personal access token in my case. Hope it will work for you:

Brilliant! That workaround fixed it. Thank you so much, @bnzo! πŸ’―πŸ₯‡

rhysd commented 3 years ago

https://github.com/rhysd/changelog-from-release/blob/master/action/entrypoint.sh#L26

The line is here. I thought github-token input is mapped to INPUT_GITHUB_TOKEN env var, but I might misunderstand. I'll check behavior of input in GitHub's documentation.

rhysd commented 3 years ago

Ah, I see, spaces in input names are replaced with _ but - is not.

https://github.com/rhysd/changelog-from-release/runs/1970182350?check_suite_focus=true#step:3:92

INPUT_GITHUB-TOKEN=***

From documentation https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions,

The environment variable created converts input names to uppercase letters and replaces spaces with _ characters.

rhysd commented 3 years ago

~8fda90b~d61c92e fixed this issue and I release new version ~v2.2.1~v2.2.2. Using rhysd/changelog-from-release/action@v2 now should work fine.

rhysd commented 3 years ago

I confirmed the fix works fine:

γ‚Ήγ‚―γƒͺγƒΌγƒ³γ‚·γƒ§γƒƒγƒˆ 2021-02-24 23 12 03