Skip to content

Conversation

jamacku
Copy link
Member

@jamacku jamacku commented Jan 27, 2023

If the first commit is pushed to a new branch, ${{ github.event.before }} has a default value of 0000000000000000000000000000000000000000.

When we detect such SHA, we should try to get older BASE SHA from the HEAD branch if possible.

Inspired by:

If the first commit is pushed to a new branch, `${{ github.event.before }}` has a default value of `0000000000000000000000000000000000000000`.

When we detect such SHA, we should try to get older `BASE` SHA from the `HEAD` branch if possible.

Inspired by:

* [How can I get the previous commit before a push or merge in GitHub Action workflow? - Answered by Peter Evans](https://stackoverflow.com/a/61861763/10221282)
* [tj-actions/changed-files GitHub Action](https://github.com/tj-actions/changed-files/blob/main/diff-sha.sh#L116-L118)
assert_success
assert_output \
"first commit on new branch detected
BASE:\"${TRUE_BASE}\" ; HEAD:\"${INPUT_PUSH_EVENT_HEAD}\""

Check warning

Code scanning / shellcheck

TRUE_BASE is referenced but not assigned.

TRUE_BASE is referenced but not assigned.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant