Skip to content

feat: make slack notification explictly opt in#60

Merged
ruocco-l merged 4 commits intomasterfrom
feat/make-slack-report-opt-in
Mar 20, 2026
Merged

feat: make slack notification explictly opt in#60
ruocco-l merged 4 commits intomasterfrom
feat/make-slack-report-opt-in

Conversation

@ruocco-l
Copy link
Contributor

Closes #55

Now report-tests and release commands must include --notify-slack or it will not trigger the notify notification, but just show the failed errors in the terminal.

@ruocco-l ruocco-l requested a review from oklinov March 17, 2026 15:28
@ruocco-l ruocco-l self-assigned this Mar 17, 2026
Copy link
Member

@metalwarrior665 metalwarrior665 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just small nits

bin/main.ts Outdated
Comment on lines 147 to 159
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just like this? (just format it after me :) ) Not sure why we would log error if we choose to not notify.

    Suggested change
  


  
      
        
        
      
      
        
                    
      
      
        
                    if (notifySlack) {
      
      
        
                        await notifyToSlack({
      
      
        
                              changedFiles,
      
      
        
                              commits,
      
      
        
                              changelog,
      
      
        
                              repository,
      
      
        
                              dryRun,
      
      
        
                              author,
      
      
        
                          });
      
      
        
                    };

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought that since not sending the notification is the default, having a message that texplicitly says that you can actually send the notification can be informative, for either people that do not know how to set it up and people who simply forgot to add the flag

console.error('SLACK:', slackMessage);
console.error('\tblocks:', blocks.join('\n\t\t'));

if (!notifySlack) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would move this above the channel selection as it is part of the slack logic

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, I wanted to leave this in because I liked the message, but I guess the diff will be enough to evaluate the results 👍

bin/main.ts Outdated
(args) =>
args
.option('report-file', { type: 'string', demandOption: true })
.option('notify-slack', { type: 'boolean', default: false })
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we would want to make this more usable outside of our team, we would probably need to make the Slack channels configurable etc. but for now this will do

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this is already a breaking change, what if we added now 2 new cli arguments for defining slack channels instead of this flag?

So instead of

apify-test-tools --notify-slack

we'd have

apify-test-tools --report-slack-channel '#notif-google-maps' --release-slack-channel '#delivery-public-actor'
  • #delivery-public-actor could be a variable at the org level
  • #notif-google-maps we'd take it from the env: `"#notif-$(echo $GITHUB_REPOSITORY | cut -d '/' -f 2)"
    • use cat to remove the apify-store/ part

In the GH workflow file, we would have:

npx apify-test-tools release --push-event-path ${{ github.event_path }} --release-slack-channel ${{ var.release_slack_channel }} --report-slack-channel "#notif-$(echo $GITHUB_REPOSITORY | cut -d "/" -f 2)"

Copy link
Member

@metalwarrior665 metalwarrior665 Mar 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't worry about breaking changes, this is used only with us and we control https://github.com/apify-store/github-actions-source :)

Feel free to go with the suggested change although I don't think it is really needed at this point. But it would be good to eventually look at the whole thing and try to restructure it so it is more generally usable. Like now it would still rely on the slack tokens in env.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I like passing the channel name instead of a notify-slack flag which feels very generic. That being said, I did the changes but I can just revert them if you think there is too much stuff going on for now :)

Copy link
Member

@metalwarrior665 metalwarrior665 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks correct to me. We should figure out how to test this in the wild, probably manually adjust the beta version https://github.com/apify-store/testing-repo-for-github-actions and in the actions make sure we don't override the beta

@metalwarrior665
Copy link
Member

@ruocco-l Here is how to test it after you merge.

  1. Since this starts with feat, it should make automatic beta npm release. see the current ones
  2. If it doesn't, let me know. You can release manually by going to Actions and selecting npm publish workflows on the left and fill master branch and beta target.
  3. Then make a PR to https://github.com/apify-store/github-actions-source/ since these things need to go hand in hand.
  4. Then you can test it manually with https://github.com/apify-store/testing-repo-for-github-actions. Change the source actions branch in workflows and change the apify-test-tools library to the new beta. I made it that the beta version is never overriden
  5. Check it correctly uses the Slack channels. The testing repo has legit slack channel too

If you have idea how to automate this whole thing, that would be golden :D (AI might know)

@ruocco-l ruocco-l merged commit 32fda72 into master Mar 20, 2026
9 checks passed
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.

Make slack report opt-in

4 participants