Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue:
In our setup, we have tags, changelog, released, and deployment occur when a PR is closed, and the state is merged=true. To do this, the GitHub actions make a new PR and output the changelog from GitHub-tag-action to the CHANGELOG.md. Then after merging the PR ( which skips a second changelog run), a release is created using the same changelog output from this module.
This works great; however, at concurrency, we have noticed the following issues where a commit in Branch B is in the past compared to the tag ref that was generated.
Cause:
When looking at this, I realized the context is that we are in a closed state. payload is a bit different. Rather than just having the base and head sha's, it also has a list of commits with their sha's and message. I can find commits from this branch when the API's compareCommits is not finding any commit.
Solution:
When a PR is closed, the
context.payload.pull_request
is undefined and instead hascontext.payload.commits
available. Unlike when the PR is open, these are not just sha items or a URL to the commits but a list of the commit with all the values you would have usually gotten from compareCommits without worrying about the tag issues described above.As a result, we get the following output after this patch :
This will only fire if normal mode fails to find commits so it's only a backup method when before assuming there are not commits to compare, as we know PR's MUST have commits in them.