'GitHub Action Js: importing modules from a different project in a github action

I am trying to figure out whether it's possible for me to import files from a different project folder. Due to certain constraints, these folders need to be separated, and I am not allowed to put one project folder into the other...

An example:

Project1
   ├── moduleA.test.js

Project2
   ├── moduleB.js

In Project1/moduleA.test.js

//This works locally but not on GitHub Action because the project folder is only available locally
import { moduleB } from '../Project2/moduleB';
...

I tried checking out Project2 thinking that it would allow the importing to work but it didn't for me.

In Project1/.github/workflows/pr.yml

    - name: Checkout Project2
      uses: actions/checkout@v3
      with:
        repository: my-org/Project2
        token: ${{ secrets.GH_PAT }}
        path: my-tools

Any help would be greatly appreciated!



Sources

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

Source: Stack Overflow

Solution Source