Skip to content

Is it possible to use GHA to automatically post a comment on any PR including changes to a certain filepath? #69944

Answered by xWuWux
nicholaspshaw asked this question in Actions
Discussion options

You must be logged in to vote

The answer to your question is yes. It is possible to use GitHub Actions to automatically post a comment on any PR including changes to a certain filepath.

To do this, you can use the following steps:

Create a new GitHub Actions workflow file in your repository. This workflow will run when a pull request is opened or modified.
In the workflow file, define the events that trigger the workflow. In your case, you want the workflow to trigger pull_request events.
Define conditions that check if the PR includes changes to the specific file path or directory. You can use the GitHub.event.pull_request.changed_files context to access the list of changed files in the PR.
Use the GitHub API to crea…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
2 replies
@nicholaspshaw
Comment options

@nicholaspshaw
Comment options

Comment options

You must be logged in to vote
2 replies
@nicholaspshaw
Comment options

@bfelbo
Comment options

Answer selected by nicholaspshaw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Actions Build, test, and automate your deployment pipeline with world-class CI/CD Question
4 participants