is workspace parameter working ?
gcollin opened this issue · 3 comments
Describe the bug
I'm checking put several github repos into subdirectories, and build them one by one in order to make a release with multiple directories.
That means the default workplace directory is not under git.
When running the github-pages-deploy-action, despite a correct workspace parameter, a git init error occured, as if the workspace parameters has been ignored.
Reproduction Steps
The complete github workflow can be found here: https://github.com/dont-code/release/blob/main/.github/workflows/release.yml
It does checkout several subdirectories:
- name: Checkout all repositories
uses: actions/checkout@v3
with:
repository: dont-code/core
**path: core**
fetch-depth: 0
ref: main
- uses: actions/checkout@v3
with:
repository: dont-code/plugins
**path: plugins**
fetch-depth: 0
ref: main
it builds the angular application, test it, and so on. And deploys the result to github pages:
- if: ${{ success() && inputs.branch == 'main'}}
uses: JamesIves/github-pages-deploy-action@v4.4.0
with:
repository-name: dont-code/plugins
branch: gh-pages # The branch the action should deploy to.
folder: plugins/dist/apps/plugin-tester
workspace: ${{github.workspace}}/plugins
=> Please note I've set the workspace parameters, as it seems to tell the action to use the plugins subdirectory as root.
Logs
When running, the following error appears:
Run JamesIves/github-pages-deploy-action@v4.4.0
with:
repository-name: dont-code/plugins
branch: gh-pages
folder: plugins/dist/apps/plugin-tester
workspace: /home/runner/work/release/release/plugins
token: ***
clean: true
force: true
...
Checking configuration and starting deployment… 🚦
Deploying using Deploy Token… 🔑
Configuring git…
/usr/bin/git config --global --add safe.directory /home/runner/work/release/release
/usr/bin/git config user.name gcollin
fatal: not in a git directory
Error: There was an error initializing the repository: The process '/usr/bin/git' failed with exit code 128 ❌
Notice: Deployment failed! ❌
Despite the correct workspace parameter, it seems git is run from the root workspace.
Workflow
The complete github workflow can be found here: https://github.com/dont-code/release/blob/main/.github/workflows/release.yml
Additional Comments
When looking at the source code of your action, I see a different handling of workspace parameter compared to let's say target folder:
https://github.com/JamesIves/github-pages-deploy-action/blob/dev/src/constants.ts
targetFolder: getInput('target-folder'),
workspace: process.env.GITHUB_WORKSPACE || '',
**=> Why not getInput () ?**
The workspace parameter really shouldn't be used when running inside the GitHub Actions environment, I'm likely going to remove this option from the documentation in an upcoming version.
In your case you probably want to leverage the working-directory
parameter instead to modify the workspace: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#defaultsrun
Thanks for the reply!
I tried and it didn't work.
Maybe working-directory only works with run and not use ?
Anyway, I'll try again
Facing the same issue. I've been forced to clone repositories nested instead of side by side in order to make it work.
It's also my understanding that working-directory
only works with run
and not with uses
and with
. Interested in any solution to this issue.