Prompt Detail:
Yes, the GitHub Action can access the content of the comment that triggered it.
The content of the comment is passed to the action as an environment variable. You can access this environment variable in your workflow using the syntax ${{ github.event.comment.body }}
.
Here's an example of how you can use the content of the comment in your workflow:
yamlname: Pull Request Comment
on:
issue_comment:
types: [created]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build
run: |
echo "Building the project"
echo "Comment body: ${{ github.event.comment.body }}"
In this example, the content of the comment is accessed using the ${{ github.event.comment.body }}
syntax and printed to the console using the echo
command.
You can use the content of the comment to trigger specific actions or perform specific tasks in your workflow, depending on the keywords or phrases contained in the comment.