Skip to content

Not possible to run on specific comment?Β #278

@dedesvik

Description

@dedesvik

I want to run this regex match only on a specific comment.

eg.

  1. My github-actions [bot] makes a comment if another action runs
  2. This action parses the comment the bot makes using regex (example here: https://regex101.com/r/SpeOZS/1)
  3. The regex match value is sent to a metadata.json file

The issue I have is that this action does not seem to be able to parse a comment made by the github-actions [bot]

Is it not possible?

Here's my actions workflow:

name: Parse comment
on:
  pull_request:
      types: [edited]
jobs:
  parse_comment:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - uses: peter-evans/find-comment@v1
        id: bot
        with:
          issue-number: ${{ github.event.number }}
          body-includes: "<!-- GH BOT -->"
      - run: |
          echo ${{ steps.bot.outputs.comment-id }}
          echo ${{ steps.bot.outputs.comment-author }}

      - uses: actions-ecosystem/action-regex-match@v2
        id: description
        with:
          text: ${{ github.event.comment.body }}
          regex: '^[A-Za-z_]+:\s+(.*)$'

      - uses: actions-ecosystem/action-regex-match@v2
        id: justification
        with:
          text: ${{ github.event.comment.body }}
          regex: '^[A-Za-z]+:\s+(.*)$'

When I try to print the values of description and justification at the end of the workflow with:

      - name: Print comment body  ## A step to print the body would be nice
        env:
          description: description
          justificaton: justification
        run: |
          echo description
          echo justification

They are always empty.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions