Github Actions to make changes to a file #26842
-
Hello, I am learning to use GitHub Actions for a project and I am having difficulties. How can I use Github Actions to make changes to a file that is in my repository? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
To chang the files in the repository, generally you need to setup the steps like as below:
A simple demo:
|
Beta Was this translation helpful? Give feedback.
-
@allisonsampaio , |
Beta Was this translation helpful? Give feedback.
-
Hi @brightran Do you know how I can access the event data? (as the text of an issue_comment event) |
Beta Was this translation helpful? Give feedback.
-
You can add a step like this for debugging purposes (assuming bash as shell):
If you want to react to issue comments, you could trigger a workflow like:
Note that this won’t be run for the initial post but only subsequent comments. To access the raw text of the comment (in Markdown syntax, not converted to HTML), you can use:
If the event sub-type is Full event object example
|
Beta Was this translation helpful? Give feedback.
@allisonsampaio ,
To chang the files in the repository, generally you need to setup the steps like as below:
Use the checkout action to check out the repository to the runner machine.
Execute the shell scripts or actions to modify the files.
Run the ralated git commands to commit and push the changes to the repository on GitHub.