Get contents/body of issue in action

As a user I would like to read the content of an issue so that I can use a GitHub action to update and commit a json file in my repo such that GitHub issue screens act like a UI.

The trigger for action would be applying a label where the label name matches the filename.json file.

Is this possible?


When the workflow is triggered by the events related to issue (issues or issue_comment), from the github context of the workflow run you can get the details of the issue via the object “github.event.issue”.
For example:

  • github.event.issue.title - - the title of the issue.
  • github.event.issue.body - - the body (or description) of the issue, it is the first comment when creating the issue.

A simple workflow example:

on: issues

    runs-on: ubuntu-latest
      - name: View issue information
        run: |
          echo "Issue title: ${{ github.event.issue.title }}"
          echo "Issue body: ${{ github.event.issue.body }}"

# You also can print the whole github context to the logs to view more details.
      - name: View the github context
        run: echo "$GITHUB_CONTEXT"
          GITHUB_CONTEXT: ${{ toJson(github) }}
1 Like

Thank you so much. This was just what I needed.