Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error "There is nothing to commit. Exiting early" #1019

Closed
nsavelyeva opened this issue Jan 26, 2022 · 9 comments
Closed

Error "There is nothing to commit. Exiting early" #1019

nsavelyeva opened this issue Jan 26, 2022 · 9 comments
Labels
help wanted 📲 Extra attention is needed researching 📒 Currently researching potential fixes.

Comments

@nsavelyeva
Copy link

Describe the bug

With GitHub workflows I am trying to push htmlcov folder [generated for a project in https://github.com/nsavelyeva/snippman on an earlier workflow step] into a non-existing directory of a master branch in another repository https://github.com/nsavelyeva/nsavelyeva.github.io [that is supposed to keep workflow artifacts as github pages].

According to the documentation, this is achievable and all parameters that I provide seem to be correct.

Reproduction Steps

  1. Create workflow in one repository - in my case in https://github.com/nsavelyeva/snippman I have this workflow
  2. Generate some files ready to be pushed - in my case htmlcov folder containing HTML report of code coverage
  3. Use GitHub Action JamesIves/github-pages-deploy-action@v4.2.2 to push folder to a non-existing directory of another repository that serves as github pages - in my case to https://github.com/nsavelyeva/nsavelyeva.github.io
      - name: Coverage report on GitHub Pages
        if: success() || failure()
        uses: JamesIves/github-pages-deploy-action@v4.2.2
        with:
          folder: htmlcov
          repository-name: nsavelyeva/nsavelyeva.github.io
          branch: master
          target-folder: veripy/cov/${{ github.run_id }}/
          git-config-name: ${{ github.event.pusher.name }}
          git-config-email: ${{ github.event.pusher.email }}
          commit-message: Artifacts from https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
          single-commit: false

Actual result: As a result, no files were detected and GitHub Action exited with There is nothing to commit. Exiting early…

Expected result: the folder htmlcov is successfully pushed to veripy/cov/${{ github.run_id }}/ folder of nsavelyeva/nsavelyeva.github.io repository.

Logs

  with:
    folder: htmlcov
    repository-name: nsavelyeva/nsavelyeva.github.io
    branch: master
    target-folder: veripy/cov/1751466919/
    commit-message: Artifacts from https://github.com/nsavelyeva/snippman/actions/runs/1751466919
    single-commit: false
    token: ***
    clean: true

    GitHub Pages Deploy Action 🚀

    💖 Support: https://github.com/sponsors/JamesIves
    📣 Maintained by James Ives: https://jamesiv.es

    🚀 Getting Started Guide: https://github.com/JamesIves/github-pages-deploy-action
    ❓ Discussions / Q&A: https://github.com/JamesIves/github-pages-deploy-action/discussions
    🔧 Report a Bug: https://github.com/JamesIves/github-pages-deploy-action/issues
Checking configuration and starting deployment… 🚦
Deploying using Deploy Token… 🔑
Configuring git…
/usr/bin/git config user.name nsavelyeva
/usr/bin/git config user.email nsavelyeva@users.noreply.github.com
/usr/bin/git config core.ignorecase false
/usr/bin/git config --local --unset-all http.https://github.com/.extraheader
/usr/bin/git remote rm origin
/usr/bin/git remote add origin ***github.com/nsavelyeva/nsavelyeva.github.io.git
Git configured… 🔧
Starting to commit changes…
/usr/bin/git ls-remote --heads ***github.com/nsavelyeva/nsavelyeva.github.io.git refs/heads/master
Creating worktree…
/usr/bin/git worktree add --no-checkout --detach github-pages-deploy-action-temp-deployment-folder
Preparing worktree (detached HEAD fd2383c)
/usr/bin/git checkout --orphan master
Switched to a new branch 'master'
Created the master branch… 🔧
/usr/bin/git reset --hard
/usr/bin/git commit --no-verify --allow-empty -m Initial master commit
[master (root-commit) bcc9d40] Initial master commit
Creating target folder if it doesn't already exist… 📌
/usr/bin/rsync -q -av --checksum --progress /home/runner/work/snippman/snippman/htmlcov/. github-pages-deploy-action-temp-deployment-folder/veripy/cov/1751466919/ --delete --exclude CNAME --exclude .nojekyll --exclude .ssh --exclude .git --exclude .github
Checking if there are files to commit…
Running post deployment cleanup jobs… 🗑️
/usr/bin/git checkout -B github-pages-deploy-action/rtb9giod4
Switched to a new branch 'github-pages-deploy-action/rtb9giod4'
/usr/bin/chmod -R 777 github-pages-deploy-action-temp-deployment-folder
/usr/bin/git worktree remove github-pages-deploy-action-temp-deployment-folder --force
There is nothing to commit. Exiting early… 📭

Workflow

Workflow links:

  • execution
  • snippet - most of the irrelevant content is commented out there, please ignore it.

Additional Comments

@JamesIves
Copy link
Owner

Thanks for the report. I'll do some research on this tomorrow morning and get back to you once I have some details to share.

@JamesIves JamesIves added the researching 📒 Currently researching potential fixes. label Jan 26, 2022
@JamesIves
Copy link
Owner

I spent a couple of hours looking into this today and the deeper I get on this issue the more confused I become. From what I can tell the htmlcov directory is ignored from the git process somehow which is why it keeps saying there's nothing to commit. If you modify your workflow to generate this directory outside of the veripy action it will work. On the contrary if I modify the git add command to use the force flag it works, which makes sense as leveraging -f in this circumstance forcefully ignores anything set in the gitignore config.

name: veripy
on:
  push:
    branches:
      - main

jobs:
  covgate:
    name: Unit tests with coverage
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
          
      - name: View files
        if: always()
        run: |
          mkdir htmlcov
          cd htmlcov
          touch example.txt

      - name: Coverage report on GitHub Pages
        if: success() || failure()
        uses: JamesIves/github-pages-deploy-action@v4
        with:
          folder: htmlcov
          target-folder: veripy/cov/${{ github.run_id }}/
          repository-name: JamesIves/special-octo-bassoon
          branch: master
          token: ${{ secrets.PAT }}
          git-config-name: ${{ github.event.pusher.name }}
          git-config-email: ${{ github.event.pusher.email }}
          commit-message: Artifacts from https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
          single-commit: false
          silent: false

Is it possible that veripy is adding these generated directories in a way that git is unable to read them and their contents? Either via a globally set git ignore configuration, or perhaps the folder permissions are not adequate enough that git has read access to them? The deployment step is reading/seeing the files, but git for whatever reason is not so it doesn't finish.

I've tried to reproduce this as much as possible and I keep coming back to something within veripy being the culprit but it's pretty difficult to pinpoint what exactly. I've tried using multiple different static site generators under the exact same conditions and in each scenario the deployment seems to pass 😞

@JamesIves JamesIves added help wanted 📲 Extra attention is needed and removed triage ⚠️ labels Jan 27, 2022
@nsavelyeva
Copy link
Author

Thank you for your investigation, I highly appreciate your help.

You are absolutely right. Indeed, there was a recent change in the tool that generates the htmlcov folder (in version 6.1 from 2021-10-30 a new feature creates a .gitignore file inside htmlcov folder - link).

Hence, I changed veripy code to always have empty htmlcov/.gitignore file as suggested in the above link in notes for version 6.2.
Now the folder htmlcov is visible to git when using JamesIves/github-pages-deploy-action@v4.2.2 - link.

Additionally I checked the case when .gitignore of both snippman and veripy projects mention htmlcov folder, because it is included in .gitignore files generated by GitHub when you create a new repository with Python code.
I can confirm git is able to detect new files - link.

@JamesIves
Copy link
Owner

JamesIves commented Jan 27, 2022

Excellent. Looks like the source of the error now is that you need to generate a personal access token to push to a difference repository. You can see an example of me using that above with the token input, and there's documentation within the readme that shows you how to generate one. 👍

I'm going to close this issue as it looks to be resolved!

@nsavelyeva
Copy link
Author

Thank you very much for your hints, with PAT it works! 🎉

@Scarabol
Copy link

Scarabol commented Apr 1, 2022

I just started using this action and stumbled upon the same problem here. My build creates all files in a "dist" folder, which is listed in the .gitignore file, because usually I don't want to add anything from there. Is there a with to force git adding the files? Should I delete the .gitignore file during the build? Or is there any other workaround?

@Scarabol
Copy link

Scarabol commented Apr 1, 2022

I switched over from Travis CI to GitHub Actions and deleting the old branch created by Travis CI did the trick for me.

@craigdallimore
Copy link

I've hit the same snag as @Scarabol - I also have a gitignored /dist folder, maybe I've overlooked something.

@marnec
Copy link

marnec commented Dec 5, 2023

the same is happening to me with docs/ folder. If I gitignore it, the build does not start as the action finds "nothing to commit"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted 📲 Extra attention is needed researching 📒 Currently researching potential fixes.
Projects
None yet
Development

No branches or pull requests

5 participants