semantic-release / github

:octocat: semantic-release plugin to publish a GitHub release and comment on released Pull Requests/Issues
MIT License
403 stars 125 forks source link

Untagged GitHub Release #212

Closed jednano closed 5 years ago

jednano commented 5 years ago

Current behavior

I'm not sure what's triggering this PR comment, but if you click on the "GitHub Release" link you'll see that it references an untagged release, but the release is definitely tagged.

Expected behavior

"GitHub Release" links to tagged release.

Environment

    "semantic-release": "^15.13.21",
gr2m commented 5 years ago

I don't see semantic-release logs in your link?

jednano commented 5 years ago

Whoops! Try this one.

[9:35:18 PM] [semantic-release] [@semantic-release/github] › ℹ Published GitHub release: https://github.com/adobe/generator-tsx/releases/tag/untagged-14135631d9fe4df2ce3d

jednano commented 5 years ago

Should we move this to https://github.com/semantic-release/github?

michael-wolfenden commented 5 years ago

I'm seeing the same behaviour using semantic-release@15.13.21

You can see the build logs here: https://michaelwolfenden.visualstudio.com/d4fbfd13-0433-4605-b6aa-c1cd5e914d1c/_apis/build/builds/385/logs/41

2019-08-30T00:48:44.0541331Z [12:48:44 AM] [semantic-release] › ✔  Created tag v2.3.0
2019-08-30T00:48:44.0543808Z [12:48:44 AM] [semantic-release] › ℹ  Start step "publish" of plugin "@semantic-release/github"
2019-08-30T00:48:47.4183929Z [12:48:47 AM] [semantic-release] [@semantic-release/github] › ℹ  Published file https://github.com/michael-wolfenden/Reference.AzurePipelines/releases/download/untagged-27c8d4d1fb95d7da57d3/Reference.AzurePipelines.2.3.0.snupkg
2019-08-30T00:48:50.3317487Z [12:48:50 AM] [semantic-release] [@semantic-release/github] › ℹ  Published file https://github.com/michael-wolfenden/Reference.AzurePipelines/releases/download/untagged-27c8d4d1fb95d7da57d3/Reference.AzurePipelines.2.3.0.nupkg
2019-08-30T00:48:53.2667400Z [12:48:53 AM] [semantic-release] [@semantic-release/github] › ℹ  Published GitHub release: https://github.com/michael-wolfenden/Reference.AzurePipelines/releases/tag/untagged-27c8d4d1fb95d7da57d3

This is leading to issue comments linking to an invalid release

For example the following comment: https://github.com/michael-wolfenden/Reference.AzurePipelines/pull/21#issuecomment-526412227

Links to: https://github.com/michael-wolfenden/Reference.AzurePipelines/releases/tag/untagged-27c8d4d1fb95d7da57d3

Rather than: https://github.com/michael-wolfenden/Reference.AzurePipelines/releases/tag/v2.3.0

pvdlg commented 5 years ago

The URL we add to the issue/PR is the html_url we get from the Create Release GitHub API: https://developer.github.com/v3/repos/releases/#create-a-release

For some reason it seems the API respond with an incorrect URL. That would be help if someone can reproduce the issue with curl and report it to GitHub.

michael-wolfenden commented 5 years ago

I think the issue is the when you create a release with assets, this package creates a draft release: https://github.com/semantic-release/github/blob/2f3f5832c961c1e3336fe9cf078cd34d03b37646/lib/publish.js#L50

The url of the draft release will be something like: releases/tag/untagged-77dc103ccb1100aaef64

Later on, the release is updated and the draft status removed: https://github.com/semantic-release/github/blob/2f3f5832c961c1e3336fe9cf078cd34d03b37646/lib/publish.js#L111

However the original draft url is still returned rather than the now final url of: releases/tag/1.0.0

gr2m commented 5 years ago

Finally a good opportunity to give the fantastic octokit cli a try. I've reproduced the problem

See

html_url: 'https://github.com/gr2m/sandbox/releases/tag/untagged-1a0a4fc9eb94c6e4fbd6'

$ GH_TOKEN=[redacted] octokit repos create-release --owner gr2m --repo sandbox --draft --tag_name ''
{ status: 201,
  url: 'https://api.github.com/repos/gr2m/sandbox/releases',
  headers:
   { 'access-control-allow-origin': '*',
     'access-control-expose-headers':
      'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type',
     'cache-control': 'private, max-age=60, s-maxage=60',
     connection: 'close',
     'content-length': '1455',
     'content-security-policy': 'default-src \'none\'',
     'content-type': 'application/json; charset=utf-8',
     date: 'Fri, 06 Sep 2019 00:41:57 GMT',
     etag: '"026f4c8c040e8c4c984be286ec2a56cd"',
     location:
      'https://api.github.com/repos/gr2m/sandbox/releases/19796215',
     'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
     server: 'GitHub.com',
     status: '201 Created',
     'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
     vary:
      'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding',
     'x-accepted-oauth-scopes': 'repo',
     'x-content-type-options': 'nosniff',
     'x-frame-options': 'deny',
     'x-github-media-type': 'github.v3; format=json',
     'x-github-request-id': 'C855:97F5:D84EDA:102420A:5D71AB55',
     'x-oauth-scopes': 'admin:org, repo, user',
     'x-ratelimit-limit': '5000',
     'x-ratelimit-remaining': '4906',
     'x-ratelimit-reset': '1567734017',
     'x-xss-protection': '1; mode=block' },
  data:
   { url:
      'https://api.github.com/repos/gr2m/sandbox/releases/19796215',
     assets_url:
      'https://api.github.com/repos/gr2m/sandbox/releases/19796215/assets',
     upload_url:
      'https://uploads.github.com/repos/gr2m/sandbox/releases/19796215/assets{?name,label}',
     html_url:
      'https://github.com/gr2m/sandbox/releases/tag/untagged-1a0a4fc9eb94c6e4fbd6',
     id: 19796215,
     node_id: 'MDc6UmVsZWFzZTE5Nzk2MjE1',
     tag_name: null,
     target_commitish: 'latest',
     name: null,
     draft: true,
     author:
      { login: 'gr2m',
        id: 39992,
        node_id: 'MDQ6VXNlcjM5OTky',
        avatar_url: 'https://avatars3.githubusercontent.com/u/39992?v=4',
        gravatar_id: '',
        url: 'https://api.github.com/users/gr2m',
        html_url: 'https://github.com/gr2m',
        followers_url: 'https://api.github.com/users/gr2m/followers',
        following_url: 'https://api.github.com/users/gr2m/following{/other_user}',
        gists_url: 'https://api.github.com/users/gr2m/gists{/gist_id}',
        starred_url: 'https://api.github.com/users/gr2m/starred{/owner}{/repo}',
        subscriptions_url: 'https://api.github.com/users/gr2m/subscriptions',
        organizations_url: 'https://api.github.com/users/gr2m/orgs',
        repos_url: 'https://api.github.com/users/gr2m/repos',
        events_url: 'https://api.github.com/users/gr2m/events{/privacy}',
        received_events_url: 'https://api.github.com/users/gr2m/received_events',
        type: 'User',
        site_admin: false },
     prerelease: false,
     created_at: '2019-09-06T00:41:57Z',
     published_at: null,
     assets: [],
     tarball_url: null,
     zipball_url: null,
     body: null } }
semantic-release-bot commented 5 years ago

:tada: This issue has been resolved in version 5.4.4 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

michael-wolfenden commented 5 years ago

@gr2m @pvdlg Any idea when the next version of semantic-release will be released with the new @semantic-release/github package?