Subscribe to File Modification
I am reopening the below issue.
It was closed by inactivity but there are still many people desiring this feature including myself.
https://github.com/integrations/slack/issues/437#issue-303451005
Thanks for opening this issue! If you would like to help implement an improvement, read more about contributing and consider submitting a pull request.
@dw2kim and others, if you need notifications about a changed file, you can use NotiFunction App and create notification with this code:
// If this file is changed - it will trigger the notification
const FILE_TO_WATCH = 'README.md'
// This is where notification will go to
// could be a channel or a person's email.
const CHANNEL = '#test'
// Reacts to "push" event
// https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#push
exports.handler = async (input) => {
let changedFiles = []
// Iterate over commits in a push and collect modified files
input.commits.forEach(c => {
changedFiles = changedFiles.concat(c.modified)
})
// If our file is modified - send a notification
// otherwise do nothing
if (changedFiles.includes(FILE_TO_WATCH)) {
return buildMessage(input)
}
}
// Function that generates a Slack message
function buildMessage(input) {
return {
to: CHANNEL,
text: `${FILE_TO_WATCH} was changed by ${input.sender.login}: ${input.compare}`
}
}
Then connect it to the "push" event from github to send notifications like this:
@alice-engi Awesome. Thank you
Is this still relevant? If so, just comment with any updates and we'll leave it open. Otherwise, if there is no further activity, it will be closed.
The NotiFunction App is no longer working so yes, I guess this is still relevant
+1