'Trying to read a file from master is not working on github action

I have a js file like this

// test.js
exec(`git show master:src/path/to/my.json`, (err, stdout, stderr) => {
    if (err) {
        console.log('failed', stderr);
        return;
    }
    ....
}

and a script cmd

// package.json
scripts: {
    doIt: "node test.js"
}

Executing this in github action

...
   - name: Checkout
      uses: actions/[email protected]
      with:
        fetch-depth: 0
    - name: DoIt
      run: yarn doIt
...

but getting error:

failed fatal: invalid object name master

Here is the github action output

* [new branch]          master                  -> origin/master


Sources

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

Source: Stack Overflow

Solution Source