I would love to see a feautre where it is possible to subscribe to specific CHANGES to a file, when pushed to a branch.
We have a CHANGELOG.md file in the root of our repository, and would love to automatically push notifications to slack when that file changes (with a diff for example, but just the fact that it happened would be awesome as well.)
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.
I'm looking for this exact feature! I keep getting this result in Google when searching for tricks to notify myself when a certain file was changed.
+1 on this request
+1 on this request
Reposting from #1062:
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:

Most helpful comment
I'm looking for this exact feature! I keep getting this result in Google when searching for tricks to notify myself when a certain file was changed.