Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Copilot Lvl 2
Message 1 of 6

Send notification when build status changes

I am attempting to migrate from Travis to Github Actions. One piece of functionality I have been unable to figure out how to migrate is:

 

email:
recipients:
- my-address@email.com
on_failure: change
on_success: change

 

Meaning, I want to send an email notification only when the build status changes from success to failure or vice-versa. Github Actions doesn't seem to have a way to look up the previous build status. Any ideas?

5 Replies
Highlighted
GitHub Partner
Message 2 of 6

Re: Send notification when build status changes

Hi @cowwoc , 

I am sorry to tell you that there is not a similar function in GitHub Actions to send notification when build status change. 

In GitHub Actions, there is an option "Send notifications for failed workflows only" . The notification settings for GitHub Actions is in "https://github.com/settings/notifications" page.  There is the document for "Notifications for workflow runs" : https://help.github.com/en/actions/getting-started-with-github-actions/about-github-actions#notifica...

Highlighted
Copilot Lvl 3
Message 3 of 6

Re: Send notification when build status changes

I am also currently migrating to GitHub Actions.

 

Is there a way to change the notification address for only one repository? 
We have some tests, that are being executed periodically via GitHub Actions.

These Tests are hosted in their own repository and have their own CI pipeline. 

If they fail, our whole team should get notified about the failure, not only the person who last changed the test repository.
Is there a way to archieve this behaviour?

 

Ideally, the team should also get notified, once tests start succeeding again, but as you have mentioned, this is currently not supported. 

Highlighted
Pilot Lvl 1
Message 4 of 6

Re: Send notification when build status changes

Hey @saltcreek-alex and @cowwoc 

What we do in our company is just send notifications in our slack channel. We have our custom solution by you can use this freely available slack notifier https://github.com/marketplace/actions/action-slack

You can also search for slack notifiers under the marketplace to check out other options.

Highlighted
Copilot Lvl 2
Message 5 of 6

Re: Send notification when build status changes

Hey Chris,

 

I think you misunderstood the question. We only want to receive notification when the build status changes states (from success to failure or vice-versa). We don't want to receive consecutive success, failure notifications.

Highlighted
Pilot Lvl 1
Message 6 of 6

Re: Send notification when build status changes

Hey, @cowwoc oh you're right, I guess that's different.

I guess you can roll your own solution by accessing the actions API and compare the result of the last run. You can do that in the if (success) and if (fail) clause so that you'll only need to compare it with the last run before the current one.