ad-m / github-push-action

GitHub actions to push back to repository eg. updated code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Subfolder uploaded to the main folder of the project instead of the dir path indicated under 'Directory' input

matteemol opened this issue · comments

I'm trying to commit some files and folders to a subfolder of my main project, but all the documents end up in a pull request in the wrong location.
In some part of my workflow, I have this output:
image

Then, the commit & push part of the script shows the following:
image

This is the last part of the workflow script that I'm running:
image

When I try to make the pull request, I see that all the files were pushed to the base directory instead of the expected /docs/build/html stated in the 'Directory' input:
image

Am I doing something wrong?

Thanks in advance!

repository: https://github.com/matteemol/dbSketcher
workflow file: https://github.com/matteemol/dbSketcher/blob/main/.github/workflows/commit-doc-changes.yml

Edit: updated the links

Hello @matteemol,

I have checked your workflow file and found some possible optimizations. I have the feeling that the files are already being created in the wrong directory and am setting up a test case on my end.

Regards,

Pascal

Thanks @ZPascal , the workflow it's kind of a Frankenstein creation, so it's probably not the best.

I tried to follow the directives in the docs for the action in this repo, and I felt like I was doing it ok, so I opened the issue.

Although, I'm possibly 'dividing by zero' somewhere, so this issue might just be something that I'm doing wrong.

If that's the case, sorry to bother

Thanks @ZPascal , the workflow it's kind of a Frankenstein creation, so it's probably not the best.

@matteemol We can handle it together to get the expected result.

I tried to follow the directives in the docs for the action in this repo, and I felt like I was doing it ok, so I opened the issue.
Although, I'm possibly 'dividing by zero' somewhere, so this issue might just be something that I'm doing wrong.
If that's the case, sorry to bother

No, problem. I'll support you.

I've opened a PR and adjusted the corresponding GH action. I hope I understand you correctly and it matches your required case.

name: Commit documentation changes

on: workflow_dispatch

jobs:
  build:

    runs-on: ubuntu-latest
 
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: '3.9'
 
      - name: Install dependencies
        run: |
          python -m pip install -r requirements.txt

      - name: make the sphinx docs
        run: |
          make -C docs clean 
          # sphinx-apidoc -f -o docs/source . -H Test -e -t docs/source/_templates
          make -C docs html

      - name: Init new repo in dist folder and commit generated files
        run: |
          cd docs/build/html/
          touch .nojekyll
          git add -A
          git config --local user.email "action@github.com"
          git config --local user.name "GitHub Action"
          git commit -m 'deploy'

      - name: Force push to destination branch
        uses: ad-m/github-push-action@master
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          branch: rtd-pages
          force_with_lease: true

I have adjusted the folder configuration as you are pushing from this folder to a new branch and this leads to the corresponding case on your side.

The issue is solved. I'll close the case.

Thank you very much @ZPascal. It took me some time to understand what was really going on under the hood.
I now realize the mistake I've made in the workflow and the misinterpretation of the 'Directory' directive I've done.

In fact, the problem was the line moving to the docs/build/html directory (line 33) before staging the changed files.

Sorry for bothering, I really appreciate your help!

Thank you very much @ZPascal. It took me some time to understand what was really going on under the hood. I now realize the mistake I've made in the workflow and the misinterpretation of the 'Directory' directive I've done.

In fact, the problem was the line moving to the docs/build/html directory (line 33) before staging the changed files.

Sorry for bothering, I really appreciate your help!

@matteemol Sure :)