'Triggering action by PR comment - action dosn't return status

I have strange issue with github action, let me describe step by step:

Assumption:

Creating PullReqest -> manually verification by some specific text in PR comment like "ok" -> PR can be merged.

I decided to use gihub action + setting in branch protection like:

Require status checks to pass before merging

Where is problem:

After creation PR, github action is triggered by right comment, but status is not returned to PR.

Looks like:

Some checks haven’t completed yet

1 expected check

deploy Expected — Waiting for status to be reported

I used example from:

https://github.community/t/trigger-a-github-workflow-if-it-matches-a-particular-comment-in-the-pull-request/116402/2

I also tried to use Github API by POST status, like described here:

Github says "Waiting for status to be reported" for a valid existing job

Do you have some experience or idea why the status is not updated?

If I use other trigger like:

on: pull_request: types: [opened]

works good.



Solution 1:[1]

Here's an example:

name: PR commented

on: issue_comment

jobs:
  pr:
    if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, 'ok') }}
    runs-on: ubuntu-latest
    steps:
      - name: Print
        run: |
          echo "It's OK!"

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 frennky