Skip to content
Discussion options

You must be logged in to vote

Hi @damianomuzzolon2,

Your workflow is checking out the default branch, but your script.py only exists on the PR branch. For issue_comment-triggered jobs, you need to explicitly check out the PR’s ref.

Try this version:

name: run-file-on-comment
on:
  issue_comment:
    types: [created]

jobs:
  run-script:
    # 1) Only run on PR comments
    # 2) Only when the comment body is exactly "execute" (case-insensitive, trimmed)
    # 3) Only when the commenter is a repo member/collaborator (security)
    if: >
      github.event.issue.pull_request &&
      startsWith(trim(github.event.comment.body), 'execute') &&
      (github.event.comment.author_association == 'MEMBER' ||
       github.event…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by damianomuzzolon2
Comment options

You must be logged in to vote
1 reply
@jihanurrahman33
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Actions Build, test, and automate your deployment pipeline with world-class CI/CD Question Ask and answer questions about GitHub features and usage Workflow Configuration Topics about workflow files, YAML setup, job dependencies, and general workflow configuration issues
3 participants