super-linter: Super linter not finding changed files in workflow triggered by `issue_comment` event

Is there an existing issue for this?

  • I have searched the existing issues

Are you using the latest Super-linter version available?

  • I am using the latest Super-linter version.

  • I can reproduce the issue running Super-linter using complete version identifier (example: vX.Y.Z), and not just with a partial one (example: vX)

  • I am using the super-linter/super-linter action or container image, and not the deprecated github/super-linter action or container image.

Are you resonably sure that it’s a Super-linter issue, and not an issue related to a tool that Super-linter runs?

  • I think that this is a Super-linter issue.

Current Behavior

I have a workflow that is configured to trigger from an issue_comment event.

Minimal public repo

This successfully triggers when a comment starting with /lint is posted to a PR for a file with known linting issues. Workflow output grahame-student/issue_ops#3

The triggered workflow, which includes a super-linter step does not find any file to lint. Image

Expected Behavior

I would expect the linter to find the modified file, as per my reference workflow, which is triggered from a pull_request event.

Reference workflow logs demonstrating the expected behaviour.

Super-Linter version

v7.2.1

Super-linter configuration

---
name: Carry out linting via IssueOps command

on:
  issue_comment:
    types: [created]

permissions:
  actions: read
  attestations: read
  checks: read # required for checking if the CI checks have passed on a pull request (if using this Action in the context of PR comments)
  contents: read # issue github/command#49 shows that this permission is also needed
  deployments: read
  id-token: none
  issues: write # required for adding reactions to command comments on issues
  discussions: read
  packages: read
  pages: read
  pull-requests: write # required for adding reactions to command comments on PRs
  repository-projects: read
  security-events: read
  statuses: read

jobs:
  issue-ops-linting:
    if: (github.event.issue.pull_request && startsWith(github.event.comment.body, '/lint'))
    name: Do work on PR comments
    runs-on: ubuntu-latest
    steps:
      - uses: github/command@v1.4.0
        id: command
        with:
          command: "/lint"
          reaction: eyes
          success_reaction: "rocket" # <-- NEW: adds a πŸš€ only if your command succeeds
          failure_reaction: "-1" # <-- NEW: adds a πŸ‘Ž  if your command fails
          allowlist: grahame-student
          skip_ci: true

      - name: Checkout PR branch
        if: ${{ steps.command.outputs.continue == 'true' }}
        uses: actions/checkout@v4.2.2
        with:
          # Adjust checked out ref to match pr triggered workflow
          ref: "refs/pull/${{ github.event.issue.number }}/merge"
          fetch-depth: 0
                  
      - uses: actions/github-script@v7.0.1
        id: get-pr-details
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          script: |
            const pr = await github.rest.pulls.get({
              owner: context.repo.owner,
              repo: context.repo.repo,
              pull_number: ${{ steps.command.outputs.issue_number }}
            });
            return {
              "sha": pr.data.head.sha,
              "base_ref": pr.data.base.ref
            }

      - name: Run Super Linter
        uses: super-linter/super-linter/slim@v7.2.1
        env:
          DEFAULT_BRANCH: ${{ fromJSON(steps.get-pr-details.outputs.result).base_ref }}
          GITHUB_TOKEN: ${{ github.token }}
          VALIDATE_ALL_CODEBASE: false

Relevant log output

2025-02-20T18:36:28.0900630Z 2025-02-20 18:36:28 [DEBUG]   Check if VUE_PRETTIER supports fix mode by checking if VUE_PRETTIER_FIX_MODE_OPTIONS, VUE_PRETTIER_CHECK_ONLY_MODE_OPTIONS, or both variables are set.
2025-02-20T18:36:28.0934968Z 2025-02-20 18:36:28 [DEBUG]   Assuming that VUE_PRETTIER supports fix mode because VUE_PRETTIER_FIX_MODE_OPTIONS, VUE_PRETTIER_CHECK_ONLY_MODE_OPTIONS, or both variables are set.
2025-02-20T18:36:28.0969830Z 2025-02-20 18:36:28 [DEBUG]   The configuration didn't provide a value for FIX_VUE_PRETTIER for VUE_PRETTIER. Setting it to: false
2025-02-20T18:36:28.1003949Z 2025-02-20 18:36:28 [DEBUG]   FIX_VUE_PRETTIER has a valid boolean string value: false
2025-02-20T18:36:28.1042508Z 2025-02-20 18:36:28 [DEBUG]   Check if XML supports fix mode by checking if XML_FIX_MODE_OPTIONS, XML_CHECK_ONLY_MODE_OPTIONS, or both variables are set.
2025-02-20T18:36:28.1076176Z 2025-02-20 18:36:28 [DEBUG]   Assuming that XML doesn't support fix mode because it doesn't have XML_FIX_MODE_OPTIONS, nor XML_CHECK_ONLY_MODE_OPTIONS variables defined.
2025-02-20T18:36:28.1110981Z 2025-02-20 18:36:28 [DEBUG]   The configuration didn't provide a value for FIX_XML for XML
2025-02-20T18:36:28.1145020Z 2025-02-20 18:36:28 [DEBUG]   Check if YAML supports fix mode by checking if YAML_FIX_MODE_OPTIONS, YAML_CHECK_ONLY_MODE_OPTIONS, or both variables are set.
2025-02-20T18:36:28.1179100Z 2025-02-20 18:36:28 [DEBUG]   Assuming that YAML doesn't support fix mode because it doesn't have YAML_FIX_MODE_OPTIONS, nor YAML_CHECK_ONLY_MODE_OPTIONS variables defined.
2025-02-20T18:36:28.1213510Z 2025-02-20 18:36:28 [DEBUG]   The configuration didn't provide a value for FIX_YAML for YAML
2025-02-20T18:36:28.1249063Z 2025-02-20 18:36:28 [DEBUG]   Check if YAML_PRETTIER supports fix mode by checking if YAML_PRETTIER_FIX_MODE_OPTIONS, YAML_PRETTIER_CHECK_ONLY_MODE_OPTIONS, or both variables are set.
2025-02-20T18:36:28.1283087Z 2025-02-20 18:36:28 [DEBUG]   Assuming that YAML_PRETTIER supports fix mode because YAML_PRETTIER_FIX_MODE_OPTIONS, YAML_PRETTIER_CHECK_ONLY_MODE_OPTIONS, or both variables are set.
2025-02-20T18:36:28.1317729Z 2025-02-20 18:36:28 [DEBUG]   The configuration didn't provide a value for FIX_YAML_PRETTIER for YAML_PRETTIER. Setting it to: false
2025-02-20T18:36:28.1352488Z 2025-02-20 18:36:28 [DEBUG]   FIX_YAML_PRETTIER has a valid boolean string value: false
2025-02-20T18:36:28.1389302Z 2025-02-20 18:36:28 [DEBUG]   User did not provide a SSL_CERT_SECRET
2025-02-20T18:36:28.1422681Z 2025-02-20 18:36:28 [DEBUG]   Building file list...
2025-02-20T18:36:28.1457260Z 2025-02-20 18:36:28 [DEBUG]   VALIDATE_ALL_CODEBASE: false
2025-02-20T18:36:28.1491944Z 2025-02-20 18:36:28 [DEBUG]   TEST_CASE_RUN: false
2025-02-20T18:36:28.1525020Z 2025-02-20 18:36:28 [DEBUG]   Build the list of all changed files
2025-02-20T18:36:28.1558422Z 2025-02-20 18:36:28 [DEBUG]   Generating Diff with:[git -C "/github/workspace" diff --diff-filter=d --name-only origin/main...d7957dc44bb4f8b68506f6aafad7c8611f6b3a7c | xargs -I % sh -c 'echo "/github/workspace/%"' 2>&1]
2025-02-20T18:36:28.1625019Z 2025-02-20 18:36:28 [DEBUG]   RAW_FILE_ARRAY contents: 
2025-02-20T18:36:28.1663093Z 2025-02-20 18:36:28 [WARN]   No files were found in the GITHUB_WORKSPACE:[/github/workspace] to lint!
2025-02-20T18:36:28.1696567Z 2025-02-20 18:36:28 [DEBUG]   Checking if we are in test mode before configuring the list of directories to lint. TEST_CASE_RUN: false
2025-02-20T18:36:28.1730185Z 2025-02-20 18:36:28 [DEBUG]   Add GITHUB_WORKSPACE (/github/workspace) to the list of files to lint because we might need it for linters that lint the whole workspace
2025-02-20T18:36:28.1763096Z 2025-02-20 18:36:28 [DEBUG]   ANSIBLE_DIRECTORY (/github/workspace/ansible) does NOT exist.
2025-02-20T18:36:28.1797842Z 2025-02-20 18:36:28 [DEBUG]   PARALLEL_RESULTS_FILE_PATH when building the file list: /tmp/super-linter-output/super-linter-parallel-results-build-file-list.json
2025-02-20T18:36:28.1853315Z 2025-02-20 18:36:28 [DEBUG]   LOG_DEBUG is enabled. Enable verbose ouput for parallel
2025-02-20T18:36:28.1888248Z 2025-02-20 18:36:28 [DEBUG]   PARALLEL_COMMAND to build the list of files and directories to lint: parallel --will-cite --keep-order --max-procs 4 --results /tmp/super-linter-output/super-linter-parallel-results-build-file-list.json --xargs --verbose --max-lines 10 BuildFileArrays
2025-02-20T18:36:28.1940926Z 2025-02-20 18:36:28 [DEBUG]   Created FILE_ARRAYS_DIRECTORY_PATH: /tmp/super-linter-output/super-linter-file-arrays
2025-02-20T18:36:28.1974348Z 2025-02-20 18:36:28 [INFO]   Building the list of files and directories to check
2025-02-20T18:36:28.4556850Z 2025-02-20 18:36:28 [DEBUG]   PARALLEL_COMMAND_OUTPUT to build the file list (exit code: 0):
2025-02-20T18:36:28.4557640Z BuildFileArrays /github/workspace
2025-02-20T18:36:28.4616458Z 2025-02-20 18:36:28 [DEBUG]   Parallel output file (/tmp/super-linter-output/super-linter-parallel-results-build-file-list.json) contents when building the file list:
2025-02-20T18:36:28.4619544Z { "Seq": 1, "Host": ":", "Starttime": 1740076588.400, "JobRuntime": 0.047, "Send": 0, "Receive": 1288, "Exitval": 0, "Signal": 0, "Command": "BuildFileArrays /github/workspace", "V": [ "/github/workspace" ], "Stdout": "2025-02-20 18:36:28 [DEBUG]   Categorizing the following files: /github/workspace
2025-02-20T18:36:28.4621357Z 2025-02-20 18:36:28 [DEBUG]   FILTER_REGEX_INCLUDE: , FILTER_REGEX_EXCLUDE: , TEST_CASE_RUN: false
2025-02-20T18:36:28.4622417Z 2025-02-20 18:36:28 [DEBUG]   FILE: /github/workspace, FILE_TYPE: /github/workspace, BASE_FILE: workspace, FILE_DIR_NAME: /github
2025-02-20T18:36:28.4623940Z 2025-02-20 18:36:28 [DEBUG]   /github/workspace matches with /github/workspace. Adding it to the list of directories to lint for linters that are expected to lint the whole codebase
2025-02-20T18:36:28.4625723Z 2025-02-20 18:36:28 [DEBUG]   Checking if /action/lib/.automation/.checkov.yaml contains a 'directory:' configuration option
2025-02-20T18:36:28.4626585Z 2025-02-20 18:36:28 [DEBUG]   /action/lib/.automation/.checkov.yaml doesn't contain a 'directory:' statement
2025-02-20T18:36:28.4627162Z 2025-02-20 18:36:28 [DEBUG]   Adding /github/workspace to the list of directories to analyze with Checkov.

Steps To Reproduce

  1. Fork minimal repo
  2. Change lint 37 in the workflow file to an appropriate user name to allow command to be actioned
  3. Raise PR containing changes with known linting issues. This should trigger the workflow looking for a pull_request event.
  4. Add a comment to the PR containing /lint and click comment. This should trigger the workflow looking for an issue_comment, where no modified files are detected.

Anything else?

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 16 (10 by maintainers)

Most upvoted comments

Before going ahead with the implementation you suggested, I would see if you can extend the pull_request case to partially reuse that logic.

Also, I would consider how you would test this behavior.