slack icon indicating copy to clipboard operation
slack copied to clipboard

Notify workflows only on errors

Open samsaggace opened this issue 2 years ago • 57 comments

Is your feature request related to a problem? Please describe. To avoid generating too much noise on our slack channel, I would like to get a notification on workflows only when it fails.

Describe the solution you'd like Adding this configuration like workflows:{event:"push", branch:"main", when: "failed" } would be super useful.

Describe alternatives you've considered For the moment we are using a github action (ravsamhq/notify-slack-action) to do the job but it has to be added on every job of every workflow...

Additional context To be clear, having only this notification on workflows would be perfect for me : image without in progress and in thread details

Thanks !

samsaggace avatar Dec 08 '22 09:12 samsaggace

Thanks for the feedback. We will collate all the requests and pick it up during the next iteration of improvements.

ashokirla avatar Dec 08 '22 16:12 ashokirla

This feature would be super useful. thumbs up!

a-pedroso avatar Jan 31 '23 15:01 a-pedroso

+1 🙏

danielsiwiec avatar Feb 22 '23 03:02 danielsiwiec

Is there any update on this? This would be very useful

Yarden-zamir avatar Mar 01 '23 10:03 Yarden-zamir

@ashokirla

Thanks for the feedback. We will collate all the requests and pick it up during the next iteration of improvements.

Thank you. Quick question, any clue on when the next iteration of improvements will be released?

surajthapa12 avatar Mar 28 '23 23:03 surajthapa12

The ability to subscribe to only the failed workflows would be super helpful to help reduce the notification noise :pray:

pashcan avatar Apr 05 '23 09:04 pashcan

any update here? 🙏 It would be awesome to avoid including many extra steps in all the workflows just for notifications

mknet3 avatar Apr 10 '23 11:04 mknet3

Would be super helpful

connorjchen avatar Apr 13 '23 21:04 connorjchen

Waiting desperately for this. Otherwise notifications for many repositories are too spammy

[edit] We have multiple teams maintaining ~50 small repos each. Usually builds pass due to our good test coverage, so the only notifications on build fails and fixed builds are important for us

MerzDaniel avatar Apr 25 '23 08:04 MerzDaniel

Jenkins has the nice feature for notifying on

  • failed builds
  • fixed builds (first successful build after a fail)

So extending the config as in the main description could be something like this: workflows:{event:"push", branch:"main", when: "failed,fixed" }

MerzDaniel avatar May 03 '23 13:05 MerzDaniel

Hi, @bkeepers @ashokirla you can improve GitHub Actions workflow configuration to make notifications more efficient. I propose implementing a configuration such as: workflows:{event:"pull_request","push", "schedule", when: "failed"}

This configuration ensures that we receive notifications only when a workflow has failed, making it easier to focus on issues that need immediate attention. Once the failed workflow is resolved and we receive a green notification

rohammosalli avatar May 03 '23 13:05 rohammosalli

+1!

phisco avatar May 04 '23 19:05 phisco

+1

Shekhar-rv avatar May 11 '23 07:05 Shekhar-rv

+1 Not having this makes this otherwise perfect integration almost unusable in our case. It would be great to hear an update on when we could expect someone to start work on this @ashokirla :pray:

NegatioN avatar May 11 '23 10:05 NegatioN

+1

fivestar avatar May 17 '23 10:05 fivestar

I created a custom Github action that supports these conditions. it also checks all failed jobs no need anything to add inside the workflow file, you can add it as a separate job to your workflow.

  • Send a success message if the last build failed but the current build was successful.
  • or don’t sends notifications for successful workflow runs if you set SEND_SUCCESS_NOTIFICATIONS environment variable to false.
  • Send a message if there was a failed build.

You can check it here: https://github.com/rohammosalli/slack-action

rohammosalli avatar May 17 '23 13:05 rohammosalli

+1

yoannteruel avatar May 23 '23 08:05 yoannteruel

+1

TakeshiDaveau avatar Jun 01 '23 08:06 TakeshiDaveau

+1

xnog avatar Jun 02 '23 10:06 xnog

+1

kendra-human avatar Jun 07 '23 04:06 kendra-human

Before any updates are released on the official GitHub app, anyone wanting more flexibility over workflow notifications can try Endid (free for open-source repos).

You can choose to be notified of any or all statuses (queued, success, failure, canceled), and optionally choose to be notified only when the state changes - when a workflow that was previously successful suddenly fails, and then once it is fixed again.

This offers drastically reduced noise for a lot of organizations, compared to the official integration! Hope it helps some of you here for now.

The Endid Slack app is linked here.

danlester avatar Jun 08 '23 15:06 danlester

Hi all - This is my checker so I don't need to add it to every job.

name: Check for master or prod failure
on:
  workflow_run:
    workflows: [Build and Test, Build and Test 2]
    types: [completed]
    branches: [main,prod]

jobs:
  on-failure:
    runs-on: ubuntu-latest
    if: github.event.workflow_run.conclusion == 'failure' || github.event.workflow_run.conclusion == 'timed_out'
    steps:
      - uses: ravsamhq/notify-slack-action@v2
        with:
          status: ${{ github.event.workflow_run.conclusion }}
          notification_title: " ${{github.event.workflow_run.name}} - ${{github.event.workflow_run.conclusion}} on ${{github.event.workflow_run.head_branch}} - <${{github.server_url}}/${{github.repository}}/actions/runs/${{github.event.workflow_run.id}}|View Failure>"
          message_format: ":fire: *${{github.event.workflow_run.name}}* ${{github.event.workflow_run.conclusion}} in <${{github.server_url}}/${{github.repository}}/${{github.event.workflow_run.head_branch}}|${{github.repository}}>"
          footer: "Linked Repo <${{github.server_url}}/${{github.repository}}|${{github.repository}}> | <${{github.server_url}}/${{github.repository}}/actions/runs/${{github.event.workflow_run.id}}|View Failure>"
        env:
          SLACK_WEBHOOK_URL: ${{ secrets.MASTER_PROD_FAIL_SLACK }}

image @samsaggace

gs-emp avatar Jun 12 '23 20:06 gs-emp

@ashokirla any update on when this will be implemented ?

Shashwat-SRE avatar Jun 15 '23 06:06 Shashwat-SRE

+1 to this. Would be very useful for us to only know about the errors without having to modify our workflow file across multiple repos.

sammorrisdesign avatar Jun 26 '23 18:06 sammorrisdesign

for god's sake please.

realkosty avatar Jul 30 '23 20:07 realkosty

Shame I have to install custom action and deal with Slack hooks. Does anyone at GitHub still maintain this integration?

sergekukharev avatar Aug 01 '23 19:08 sergekukharev

has there been any progress on this? This would be a very useful feature.

nadasaiyed avatar Nov 13 '23 21:11 nadasaiyed

+1 to wanting this feature. I am getting around this with slack notifications but would love to get rid of that.

aiell0 avatar Nov 14 '23 14:11 aiell0

+1

emreabanozoglu avatar Dec 19 '23 11:12 emreabanozoglu

+1 Just out of curiosity, why would anyone want to subscribe to all events if everything works as it should? I mean, if the output is meant for human consumption on a slack channel :)

ohadasulin1 avatar Jan 02 '24 11:01 ohadasulin1