Commit d1b1296
committed
fix: Handle cases when
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)BASE SHA isn't known - push events1 parent d24099b commit d1b1296
2 files changed
+24
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
44 | 46 | | |
45 | 47 | | |
46 | 48 | | |
47 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
48 | 54 | | |
49 | 55 | | |
50 | 56 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
43 | 61 | | |
44 | 62 | | |
45 | 63 | | |
| |||
0 commit comments