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]Not Found #20

Closed
yi-Xu-0100 opened this issue Aug 30, 2020 · 7 comments
Closed

[error]Not Found #20

yi-Xu-0100 opened this issue Aug 30, 2020 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@yi-Xu-0100
Copy link

yi-Xu-0100 commented Aug 30, 2020

image

I don't know why, some errors occurred during my use.
This is my configuration file:

name: autoRelease
on:
  push:
    tags:
      - 'v*'

jobs:
  autoRelease:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Generate changelog
        id: changelog
        uses: metcalfc/changelog-generator@v0.4.1
        with:
          myToken: ${{ secrets.GITHUB_TOKEN }}

      - name: Create Release
        id: create_release
        uses: actions/create-release@latest
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: ${{ github.ref }}
          release_name: Release ${{ github.ref }}
          body: ${{ steps.changelog.outputs.changelog }}
          draft: false
          prerelease: false

According to my investigation, ${{ secrets.GITHUB_TOKEN }} here does not need to be added, it is generated by default, so I have not done anything except add this file.
If I did something wrong, please let me know, thank you for your work and look forward to your reply.

@yi-Xu-0100
Copy link
Author

I must use the base-ref parameter to solve this problem, but this problem is not pointed out in the example. I will try to go back to my repository, create a new repository in a similar situation and track this issue.

@metcalfc
Copy link
Owner

I think this is related to #14 if you don't have a version tag to compare against it fails. Can you create a version tag and then try again?

metcalfc added a commit that referenced this issue Aug 31, 2020
This should fix #14 and #20.

Signed-off-by: Chad Metcalf <metcalfc@gmail.com>
@metcalfc
Copy link
Owner

metcalfc commented Aug 31, 2020

Or I think I've fixed this in v.0.4.3 can you try again with that release? You shouldn't need to set a base_ref by default.

@metcalfc metcalfc self-assigned this Aug 31, 2020
@metcalfc metcalfc added the bug Something isn't working label Aug 31, 2020
@yi-Xu-0100
Copy link
Author

yi-Xu-0100 commented Sep 1, 2020

Image

Hey, Thanks for your work, but the new version didn't work.

I tried to find out where this error is. Through the continuous console output log, it should be that the following will throw an error directly instead of returning false or any determinable value.

//index.js
//dist/index.js
    if (!baseRef) {
      const latestRelease = await octokit.repos.getLatestRelease({
        owner: owner,
        repo: repo
      })
      //here will throw an error directly instead of returning false or any determinable value.
      if (latestRelease) {
        baseRef = latestRelease.data.tag_name
      } else {
        core.setFailed(
          `There are no releases on ${owner}/${repo}. Tags are not releases.`
        )
      }
    }

My test repository only has a label, but there is no release. You may need to use the initial commit to set base-ref parameter when there is no release.

@yi-Xu-0100
Copy link
Author

yi-Xu-0100 commented Sep 1, 2020

image

image

I don’t know how to set the base-ref to the latest tag, or the first commit.

@metcalfc
Copy link
Owner

metcalfc commented Sep 1, 2020

Ah I think I understand. The action does assume that you are using releases to manage your workflow. It currently isn't setup to use branches or even tags. You can work around this by setting the base_ref manually. So in your action you can write some additional step to figure out what tag or branch you want to use. Otherwise if you want it to automatically figure it out the way its setup it has to be releases.

I'm going to close this as I think its working as implemented. I only use releases with this action. If you want to take a try at making it more generalized I can review the PRs. Unfortunately, I don't have time to rework it to do something different.

@metcalfc metcalfc closed this as completed Sep 1, 2020
@yi-Xu-0100
Copy link
Author

yi-Xu-0100 commented Sep 1, 2020

This error has nothing to do with whether repository has other branch or tag, only related to whether it has a release. So I should ensure that my repository have at least one release to make workflow work on, right?

Does this need to be pointed out in the readme, because if it is a new repository, this action cannot be started without release, and it will cause a vague error similar to mine.

Thank you for taking the time to solve this problem. If I can try to solve this problem later, I will try to submit a new PR.

yi-Xu-0100 added a commit to yi-Xu-0100/changelog-generator that referenced this issue Sep 1, 2020
metcalfc added a commit that referenced this issue Dec 9, 2020
Hopefully this documents the issue folks have seen in #20 and #40
metcalfc added a commit that referenced this issue Dec 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment