+
Skip to content

[BUG] Error: Unable to locate the git repository in the given path #1948

@TomOMara

Description

@TomOMara

Is there an existing issue for this?

  • I have searched the existing issues

Does this issue exist in the latest version?

  • I'm using the latest release

Describe the bug?

Hi, i'm encountering the following error when running against a node 18.14.0 or above. The error does not occur at version 18.13.0 or below.

> Run tj-actions/changed-files@v42
/usr/bin/docker exec <hash> sh -c "cat /etc/*release | grep ^ID"
> changed-files
  Error: Unable to locate the git repository in the given path: /__w/my-repo/my-repo.
   Please run actions/checkout before this action (Make sure the 'path' input is correct).
   If you intend to use Github's REST API note that only pull_request* events are supported. Current event is "push".

To Reproduce

With the following workflow file:

name: Test Action

on:
  push:
  workflow_dispatch:

jobs:
  build-ota:
    container: public.ecr.aws/docker/library/node:18.14.0
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Check files changed
        id: changed-files-yaml
        uses: tj-actions/changed-files@v42
        with:
          files_yaml: |
            src:
              - src/**
              - '**/*.tsx'

What OS are you seeing the problem on?

ubuntu-latest or ubuntu-22.04

Expected behavior?

I'd expect there to be no error thrown using any version of node 18. There is no error when using node:18.13.0 or lower

Relevant log output

Happy logs (using node 18.13.0): 

##[debug]Evaluating condition for step: 'Check files changed'
##[debug]Evaluating: (success() && !github.event.inputs.platform)
##[debug]Evaluating And:
##[debug]..Evaluating success:
##[debug]..=> true
##[debug]..Evaluating Not:
##[debug]....Evaluating Index:
##[debug]......Evaluating Index:
##[debug]........Evaluating Index:
##[debug]..........Evaluating github:
##[debug]..........=> Object
##[debug]..........Evaluating String:
##[debug]..........=> 'event'
##[debug]........=> Object
##[debug]........Evaluating String:
##[debug]........=> 'inputs'
##[debug]......=> null
##[debug]....=> null
##[debug]..=> true
##[debug]=> true
##[debug]Expanded: (true && !null)
##[debug]Result: true
##[debug]Starting: Check files changed
##[debug]Loading inputs
##[debug]Evaluating: github.token
##[debug]Evaluating Index:
##[debug]..Evaluating github:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'token'
##[debug]=> '***'
##[debug]Result: '***'
##[debug]Evaluating: github.api_url
##[debug]Evaluating Index:
##[debug]..Evaluating github:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'api_url'
##[debug]=> 'https://api.github.com'
##[debug]Result: 'https://api.github.com'
##[debug]Loading env
Run tj-actions/changed-files@v42
/usr/bin/docker exec  73a982e4c7c25670edb3b098c959ed1e307020011f8fb4c594ebd8dd53877e6e sh -c "cat /etc/*release | grep ^ID"
##[debug]ID=debian
##[debug]Running JavaScript Action with default external tool: node20
::group::changed-files
changed-files
::group::changed-files-yaml-src
changed-files-yaml-src
##[debug]modified_keys: ["src"]
##[debug]changed_keys: ["src"]
##[debug]Node Action run completed with exit code 0


Error logs (using node 18.14.0 or above)


##[debug]Evaluating condition for step: 'Check files changed'
##[debug]Evaluating: (success() && !github.event.inputs.platform)
##[debug]Evaluating And:
##[debug]..Evaluating success:
##[debug]..=> true
##[debug]..Evaluating Not:
##[debug]....Evaluating Index:
##[debug]......Evaluating Index:
##[debug]........Evaluating Index:
##[debug]..........Evaluating github:
##[debug]..........=> Object
##[debug]..........Evaluating String:
##[debug]..........=> 'event'
##[debug]........=> Object
##[debug]........Evaluating String:
##[debug]........=> 'inputs'
##[debug]......=> null
##[debug]....=> null
##[debug]..=> true
##[debug]=> true
##[debug]Expanded: (true && !null)
##[debug]Result: true
##[debug]Starting: Check files changed
##[debug]Loading inputs
##[debug]Evaluating: github.token
##[debug]Evaluating Index:
##[debug]..Evaluating github:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'token'
##[debug]=> '***'
##[debug]Result: '***'
##[debug]Evaluating: github.api_url
##[debug]Evaluating Index:
##[debug]..Evaluating github:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'api_url'
##[debug]=> 'https://api.github.com'
##[debug]Result: 'https://api.github.com'
##[debug]Loading env
Run tj-actions/changed-files@v42
/usr/bin/docker exec  6a5309ff5f1153eb8d9d0b987b0fe38554cadbf46aa83899d0b16e85177bc3ad sh -c "cat /etc/*release | grep ^ID"
##[debug]ID=debian
##[debug]Running JavaScript Action with default external tool: node20
::group::changed-files
changed-files
  ##[debug]Env: {
  ##[debug]  "PATH": "/__t/eas-cli/7.3.0/x64/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
  ##[debug]  "HOSTNAME": "6a5309ff5f11",
  ##[debug]  "HOME": "/github/home",
  ##[debug]  "GITHUB_ACTIONS": "true",
  ##[debug]  "CI": "true",
  ##[debug]  "NODE_VERSION": "18.14.0",
  ##[debug]  "YARN_VERSION": "1.22.19",
  ##[debug]  "EXPO_TOKEN": "***",
  ##[debug]  "INPUT_FILES_YAML": "src:\n  - src/**\n  - '**/*.tsx'\n",
  ##[debug]  "INPUT_SEPARATOR": " ",
  ##[debug]  "INPUT_INCLUDE_ALL_OLD_NEW_RENAMED_FILES": "false",
  ##[debug]  "INPUT_OLD_NEW_SEPARATOR": ",",
  ##[debug]  "INPUT_OLD_NEW_FILES_SEPARATOR": " ",
  ##[debug]  "INPUT_FILES_FROM_SOURCE_FILE": "",
  ##[debug]  "INPUT_FILES_FROM_SOURCE_FILE_SEPARATOR": "\n",
  ##[debug]  "INPUT_FILES": "",
  ##[debug]  "INPUT_FILES_SEPARATOR": "\n",
  ##[debug]  "INPUT_FILES_YAML_FROM_SOURCE_FILE": "",
  ##[debug]  "INPUT_FILES_YAML_FROM_SOURCE_FILE_SEPARATOR": "\n",
  ##[debug]  "INPUT_FILES_IGNORE_YAML": "",
  ##[debug]  "INPUT_FILES_IGNORE_YAML_FROM_SOURCE_FILE": "",
  ##[debug]  "INPUT_FILES_IGNORE_YAML_FROM_SOURCE_FILE_SEPARATOR": "\n",
  ##[debug]  "INPUT_FILES_IGNORE": "",
  ##[debug]  "INPUT_FILES_IGNORE_SEPARATOR": "\n",
  ##[debug]  "INPUT_FILES_IGNORE_FROM_SOURCE_FILE": "",
  ##[debug]  "INPUT_FILES_IGNORE_FROM_SOURCE_FILE_SEPARATOR": "\n",
  ##[debug]  "INPUT_SHA": "",
  ##[debug]  "INPUT_BASE_SHA": "",
  ##[debug]  "INPUT_SINCE": "",
  ##[debug]  "INPUT_UNTIL": "",
  ##[debug]  "INPUT_PATH": ".",
  ##[debug]  "INPUT_QUOTEPATH": "true",
  ##[debug]  "INPUT_DIFF_RELATIVE": "true",
  ##[debug]  "INPUT_DIR_NAMES": "false",
  ##[debug]  "INPUT_DIR_NAMES_MAX_DEPTH": "",
  ##[debug]  "INPUT_DIR_NAMES_EXCLUDE_CURRENT_DIR": "false",
  ##[debug]  "INPUT_DIR_NAMES_INCLUDE_FILES": "",
  ##[debug]  "INPUT_DIR_NAMES_INCLUDE_FILES_SEPARATOR": "\n",
  ##[debug]  "INPUT_DIR_NAMES_DELETED_FILES_INCLUDE_ONLY_DELETED_DIRS": "false",
  ##[debug]  "INPUT_JSON": "false",
  ##[debug]  "INPUT_ESCAPE_JSON": "true",
  ##[debug]  "INPUT_SAFE_OUTPUT": "true",
  ##[debug]  "INPUT_FETCH_DEPTH": "50",
  ##[debug]  "INPUT_SKIP_INITIAL_FETCH": "false",
  ##[debug]  "INPUT_FETCH_ADDITIONAL_SUBMODULE_HISTORY": "false",
  ##[debug]  "INPUT_SINCE_LAST_REMOTE_COMMIT": "false",
  ##[debug]  "INPUT_WRITE_OUTPUT_FILES": "false",
  ##[debug]  "INPUT_OUTPUT_DIR": ".github/outputs",
  ##[debug]  "eventName": "push",
  ##[debug]  "sha": "1ea505a0b4f81ea2918beb9855c88c932014c599",
  ##[debug]  "ref": "refs/heads/ci-test-fix-1",
  ##[debug]  "workflow": "Test Action",
  ##[debug]  "action": "changed-files-yaml",
  ##[debug]  "actor": "****",
  ##[debug]  "job": "build-ota",
  ##[debug]  "runNumber": 217,
  ##[debug]  "runId": 7989125576,
  ##[debug]  "apiUrl": "https://api.github.com",
  ##[debug]  "serverUrl": "https://github.com",
  ##[debug]  "graphqlUrl": "https://api.github.com/graphql"
  ##[debug]}
  ##[debug]Working directory: /__w/my-repo/my-repo
  /usr/bin/git rev-parse --is-inside-work-tree
  fatal: detected dubious ownership in repository at '/__w/my-repo/my-repo'
  To add an exception for this directory, call:
  
  	git config --global --add safe.directory /__w/my-repo/my-repo
  ##[debug]The current working directory is not inside a git repository: /__w/my-repo/my-repo
  ##[debug]Has git directory: false
  ##[debug]Input file patterns: 
  ##[debug]
  ##[debug]File patterns: 
  ##[debug]Yaml file patterns: {"src":["src/**","**/*.tsx"]}
  Error: Unable to locate the git repository in the given path: /__w/my-repo/my-repo.
   Please run actions/checkout before this action (Make sure the 'path' input is correct).
   If you intend to use Github's REST API note that only pull_request* events are supported. Current event is "push".
  ##[debug]Node Action run completed with exit code 1
  ##[debug]Finishing: Check files changed

Has all relevant logs been included?

  • I've included all relevant logs

Anything else?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载