Following with my blog engine project (see #1 and #2), I’ve updated my GitHub Actions trigger as follows:

name: New Issue

    types: [opened, edited]

  # Allows you to run this workflow manually from the Actions tab

    runs-on: ubuntu-latest
    if: ${ { github.event.issue.user.login == github.repository_owner }} # only owner issues
      - uses: aws-actions/configure-aws-credentials@v1
          aws-access-key-id: ${ { secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${ { secrets.AWS_SECRET_ACCESS_KEY }}
          aws-region: us-east-2

      - uses: isbang/sqs-action@v0.1.1
          message: '{ "issueId": ${ {github.event.issue.number}}, "user": "${ {github.event.issue.user.login}}", "event": "$", "action": "${ {github.action}}" }'

First, I’ve added a check to ensure the issue author is the same as the repository owner. This means only issues I create will trigger the workflow and end up on my blog. This is achieved by the following line:

if: ${ { github.event.issue.user.login == github.repository_owner }} # only owner issues

Next, I’ve updated the JSON payload to include the event name and the action. The event name matches the expected issues event, but the action is not what I expected:

 body: "{ \"issueId\": 2, \"user\": \"eneko\", \"event\": \"issues\", \"action\": \"isbangsqs-action\" }"

I’m trying to identify if the issue is being created or updated. I could have two separate workflows instead, and hardcode the value, but I would expect the event activity type to be somewhere in the event object.

This article was written as an issue on my Blog repository on GitHub (see Issue #3)

First draft: 2020-12-21

Published on: 2020-12-23

Last update: 2021-01-05