Skip to content

Fix error when there is only 1 commit#82

Open
lucapino-kobalt wants to merge 1 commit intomercari:masterfrom
lucapino-kobalt:fix-single-commit
Open

Fix error when there is only 1 commit#82
lucapino-kobalt wants to merge 1 commit intomercari:masterfrom
lucapino-kobalt:fix-single-commit

Conversation

@lucapino-kobalt
Copy link

WHAT

Fix by 1 error in extracting previous commit

WHY

When the repository contains only 1 commit, the extraction of the previous commit fails:

panic: runtime error: index out of range [1] with length 1

goroutine 1 [running]:
github.com/mercari/tfnotify/notifier/github.(*CommitsService).lastOne(...)
	/home/runner/work/tfnotify/tfnotify/notifier/github/commits.go:48
github.com/mercari/tfnotify/notifier/github.(*NotifyService).Notify(0xc000102ad0, 0xc00018e480, 0x441, 0xc00000e018, 0xc000190000, 0x32e)
	/home/runner/work/tfnotify/tfnotify/notifier/github/notify.go:94 +0x875
main.(*tfnotify).Run(0xc000147380, 0xc000172d90, 0x8)
	/home/runner/work/tfnotify/tfnotify/main.go:188 +0x5e2
main.cmdApply(0xc000102840, 0x0, 0xc0000109a0)
	/home/runner/work/tfnotify/tfnotify/main.go:320 +0x1e8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant