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

Erroneous "There is nothing to commit." when clean: false and single-commit: true #807

Closed
marekdedic opened this issue Jul 21, 2021 · 11 comments
Labels
bug 🐦 Something isn't working

Comments

@marekdedic
Copy link

Describe the bug

Hi,
thanks for the action! I tried to use it and when I set both of these options, it would just say "There is nothing to commit." (incorrectly) When I removed single-commit: true, it started working...

Reproduction Steps

Set the two parameters at the same time

Logs

- name: "Download artifact"
        uses: actions/download-artifact@v2
        with:
          name: "listings"
          path: dist

      - name: Display structure of downloaded files
        run: ls -R

      - name: Deploy
        uses: JamesIves/github-pages-deploy-action@4.1.4
        with:
          branch: gh-pages
          folder: dist
          clean: false
          single-commit: true
2021-07-21T16:01:56.7650106Z ##[group]Run ls -R
2021-07-21T16:01:56.7650728Z �[36;1mls -R�[0m
2021-07-21T16:01:56.7693501Z shell: /usr/bin/bash -e {0}
2021-07-21T16:01:56.7694010Z env:
2021-07-21T16:01:56.7694523Z   cache-version: 1
2021-07-21T16:01:56.7695046Z ##[endgroup]
2021-07-21T16:01:56.7778353Z .:
2021-07-21T16:01:56.7780566Z dist
2021-07-21T16:01:56.7783636Z 
2021-07-21T16:01:56.7784075Z ./dist:
2021-07-21T16:01:56.7784511Z listings.json
2021-07-21T16:01:56.7880875Z ##[group]Run JamesIves/github-pages-deploy-action@4.1.4
2021-07-21T16:01:56.7881608Z with:
2021-07-21T16:01:56.7882058Z   branch: gh-pages
2021-07-21T16:01:56.7882612Z   folder: dist
2021-07-21T16:01:56.7883083Z   clean: false
2021-07-21T16:01:56.7883608Z   single-commit: true
2021-07-21T16:01:56.7884460Z   token: ***
2021-07-21T16:01:56.7884925Z env:
2021-07-21T16:01:56.7885389Z   cache-version: 1
2021-07-21T16:01:56.7885927Z ##[endgroup]
2021-07-21T16:01:56.8718777Z 
2021-07-21T16:01:56.8720566Z     GitHub Pages Deploy Action 🚀
2021-07-21T16:01:56.8721216Z 
2021-07-21T16:01:56.8722570Z     🚀 Getting Started Guide: https://github.com/marketplace/actions/deploy-to-github-pages
2021-07-21T16:01:56.8724257Z     ❓ Discussions / Q&A: https://github.com/JamesIves/github-pages-deploy-action/discussions
2021-07-21T16:01:56.8725939Z     🔧 Report a Bug: https://github.com/JamesIves/github-pages-deploy-action/issues
2021-07-21T16:01:56.8726803Z 
2021-07-21T16:01:56.8727870Z     📣 Maintained by James Ives: https://jamesiv.es
2021-07-21T16:01:56.8729288Z     💖 Support: https://github.com/sponsors/JamesIves
2021-07-21T16:01:56.8730609Z Checking configuration and starting deployment… 🚦
2021-07-21T16:01:56.8731703Z Deploying using Deploy Token… 🔑
2021-07-21T16:01:56.8732856Z Configuring git…
2021-07-21T16:01:56.8817943Z [command]/usr/bin/git config user.name XXX
2021-07-21T16:01:56.8936869Z [command]/usr/bin/git config user.email XXX@users.noreply.github.com
2021-07-21T16:01:56.8978759Z [command]/usr/bin/git config --local --unset-all http.https://github.com/.extraheader
2021-07-21T16:01:56.9025118Z [command]/usr/bin/git remote rm origin
2021-07-21T16:01:56.9067046Z [command]/usr/bin/git remote add origin ***github.com/XXX/XXX.git
2021-07-21T16:01:56.9094899Z Git configured… 🔧
2021-07-21T16:01:56.9098904Z Starting to commit changes…
2021-07-21T16:01:56.9111645Z [command]/usr/bin/git ls-remote --heads ***github.com/XXX/XXX.git refs/heads/gh-pages
2021-07-21T16:01:57.2358854Z 415509828f37c91a0674b12b28011b6870d3f2c3	refs/heads/gh-pages
2021-07-21T16:01:57.2360919Z Creating worktree…
2021-07-21T16:01:57.2376003Z [command]/usr/bin/git fetch --no-recurse-submodules --depth=1 origin gh-pages
2021-07-21T16:01:57.7971384Z From https://github.com/XXX/XXX
2021-07-21T16:01:57.7973052Z  * branch            gh-pages   -> FETCH_HEAD
2021-07-21T16:01:57.7984642Z  * [new branch]      gh-pages   -> origin/gh-pages
2021-07-21T16:01:57.8005064Z [command]/usr/bin/git worktree add --no-checkout --detach github-pages-deploy-action-temp-deployment-folder
2021-07-21T16:01:57.8038123Z Preparing worktree (detached HEAD 445c637)
2021-07-21T16:01:57.8071887Z [command]/usr/bin/git checkout --orphan gh-pages origin/gh-pages
2021-07-21T16:01:57.8105934Z Previous HEAD position was 445c637 Checking artifact structure
2021-07-21T16:01:57.8109499Z Switched to a new branch 'gh-pages'
2021-07-21T16:01:57.8159189Z [command]/usr/bin/rsync -q -av --checksum --progress /home/runner/work/XXX/XXX/dist/. github-pages-deploy-action-temp-deployment-folder --exclude .ssh --exclude .git --exclude .github
2021-07-21T16:01:57.8202297Z Checking if there are files to commit…
2021-07-21T16:01:57.8269600Z Running post deployment cleanup jobs… 🗑️
2021-07-21T16:01:57.8298234Z [command]/usr/bin/git checkout -B github-pages-deploy-action/3ia19hg1r
2021-07-21T16:01:57.8314858Z Switched to a new branch 'github-pages-deploy-action/3ia19hg1r'
2021-07-21T16:01:57.8342452Z [command]/usr/bin/git worktree remove github-pages-deploy-action-temp-deployment-folder --force
2021-07-21T16:01:57.8363848Z There is nothing to commit. Exiting early… 📭
@JamesIves
Copy link
Owner

Thanks for the report! I will try and investigate this over the weekend.

@JamesIves
Copy link
Owner

JamesIves commented Jul 26, 2021

Sorry for the delay on this. I've been investigating this and I'm so far not able to reproduce this bug. I've tried setting clean: false with single-commit: true and making a change in my control repo and everything seems to correctly commit when appropriate.

Are you certain there's a diff being generated between the files? It's interesting that it works when you remove single-commit: true which leads me to believe there's something going on, but I think some more examples may help me track this down.

@JamesIves JamesIves added the researching 📒 Currently researching potential fixes. label Jul 26, 2021
@marekdedic
Copy link
Author

Hi,
thanks for trying it out, I'll try to look at it next week and find out, what's really happening :)

@jana-d
Copy link

jana-d commented Jul 30, 2021

Hi James,
I ran into the same problem and removing single-commit: true fixed it for me too. I use a very similar action as another project, qcodes which did not have this issue. Let me know if this could help.

Thanks for your amazing work! :)

@marekdedic
Copy link
Author

Well, no time this week sorry... I should probably get to it by the end of August... :/

@liskin
Copy link

liskin commented Aug 7, 2021

I think this is caused by this:

const checkGitStatus =
branchExists && action.singleCommit
? `git diff origin/${action.branch}`
: `git status --porcelain`

git diff doesn't show new untracked files (git status --porcelain does), so if the only difference is addition of new files, github-pages-deploy-action incorrectly assumes there's been no change.

I wonder what's wrong with using git status --porcelain even for single-commit: true
Oh, it's because single-commit is implemented via empty history instead of git commit --amend. In that case the fix might involve doing git add before doing the git diff.

@marekdedic
Copy link
Author

I can confirm that in my case, I was only adding files, without changing any...

@JamesIves JamesIves added bug 🐦 Something isn't working help wanted 📲 Extra attention is needed and removed triage ⚠️ researching 📒 Currently researching potential fixes. labels Aug 7, 2021
@JamesIves
Copy link
Owner

Thanks for the insight @marekdedic, @jana-d and @liskin.

I've got a beta version of a potential fix you can try by pointing your workflow to JamesIves/github-pages-deploy-action@releases/v4-issue-807. I haven't had a chance to properly test this myself but will run it through the regular set of integration tests sometime this coming week.

Let me know how this works for you.

@JamesIves
Copy link
Owner

Just wondering if anyone has had a chance to check out the fix I posted above yet.

@liskin
Copy link

liskin commented Aug 16, 2021

Oh, sorry, I meant to reply and forgot about it. I haven't particularly tested your action per se, because I don't have any actions setup that would trigger the issue, but I did try executing the git commands manually in the order the fixed action would do them, and it seemed to work fine. So if your integrations tests are okay, I'd say: ship it! :-)

@JamesIves
Copy link
Owner

This has been released with version 4.1.5.

Discussion: #847

@JamesIves JamesIves removed the help wanted 📲 Extra attention is needed label Aug 26, 2021
liskin added a commit to xmonad/xmonad-docs that referenced this issue Aug 26, 2021
4.1.4 fails to pick up changes that only add new files:
JamesIves/github-pages-deploy-action#807
ooxi added a commit to gerbv/gerbv that referenced this issue Aug 29, 2021
As discussed in JamesIves/github-pages-deploy-action#807 `github-pages-deploy-action' had a bug when using `single-commit'.

Upgrading to 4.1.5 fixed that behaviour.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐦 Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants