From 3a82bc466f00539d7f457a8c4a4199aad3513d2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Touzy?= Date: Thu, 20 Oct 2022 15:58:54 +0200 Subject: [PATCH] [Fix] Fetch git tag-ref SHA for associated commit --- helpers/Git.js | 11 +++++++---- package.json | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/helpers/Git.js b/helpers/Git.js index f4b3417..f176eec 100644 --- a/helpers/Git.js +++ b/helpers/Git.js @@ -56,12 +56,15 @@ module.exports = class Git { .getRef(Object.assign({ ref: `tags/${tag}` }, this.repo)) .then(this.responseHandler) .then(responseData => { - const ref = { - sha: responseData.object.sha - } + // NOTE: This is necessary because the tag-ref SHA can be different from associated commit SHA + return self.octokit + .git + .getTag(Object.assign({ tag_sha: responseData.object.sha }, self.repo)) + }) + .then(responseData => { return self.octokit .git - .getCommit(Object.assign({ commit_sha: ref.sha }, self.repo)) + .getCommit(Object.assign({ commit_sha: responseData.data.object.sha }, self.repo)) }) .then(this.responseHandler) .then(responseData => { diff --git a/package.json b/package.json index 82ca287..83c15ab 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@pictarine/release-note-now", - "version": "1.0.7", + "version": "1.0.8", "description": "Automatic release note generator for GitHub projects", "main": "index.js", "scripts": {