Using the GitHub Actions to comment Pull Request
Hey there, I just wrote a quick story to demonstrate how you can create from your side, a simple workflow to add a comment on Pull Requests using GitHub Actions. Stay with me and check this step, itās a great time to learn more about the GitHub Actions and visualize my example in real time.
The idea is explain the workflow to you, and I hope you use it to apply on your respositories on GitHub. The GitHub Action will comments with a given message the pull request linked to the pushed branch. If you havenāt read yet my latest GitHub Actions post, please make sure you able to read and learn more on this below. Letās go now!!
Fist of all, letās check and explain how GitHub Actions works, just a simple overview according to the documentation. There are several components inside GitHub Actions such as:
Workflows ā workflows are defined in the .github/workflows
directory in a repository.
Actions ā An action is a custom application for the GitHub Actions platform that performs a complex but frequently repeated task.
Jobs ā A job is a set of steps in a workflow that execute on the same runner.
Runners ā A runner is a server that runs your workflows when theyāre triggered.
The idea is create a basic action for you to usage on your pull requests, in the past I didnāt know how I can automate this steps, I just opened the PR but I didnāt receive anything, I rememberā¦ I am not able to receive nothing from developer side, like a message for example, to show me just a position around this pull request.
After I met the actions I was delighted, the models, the integrations, components and more. Below you can check a basic example of an Action:
name: learn-github-actions
on: [push]
jobs:
check-bats-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '14'
- run: npm install -g bats
- run: bats -v
Exploring my scenario, today I have started adding actions for all my repositories on GitHub, just to keep aligned with the contributorā¦ (this message prove that you sent a pull request and I am attention on this).
The actions used
Below, the model that I am working on my case, itās simplest but functional.
The pipeline
The workflow after the action got executed on a pull request.
A simple way top automate the comments on pull request for any GitHub repositories.