actions-gh-pages icon indicating copy to clipboard operation
actions-gh-pages copied to clipboard

support: Define hooks / run commands before commit or after git init?

Open Animeshz opened this issue 2 years ago • 4 comments

Checklist

  • [X] I am using the latest version of this action.
  • [X] I have read the latest README and followed the instructions.
  • [X] I have read the latest GitHub Actions official documentation and learned the basic spec and concepts.

Describe your question

I'm having issue publishing a few asset files which are >100MB in size, which require git-lfs.

remote: error: File <large-file> is 108.69 MB; this exceeds GitHub's file size limit of 100.00 MB

But I don't know how do I set that, because a temporary git repository is made by the action, committed and pushed. Is there a way to push a few command(s) in the end of Prepare publishing assets step (e.g. git lfs install && git lfs track '*.mp4')?

Relevant links

Sample yaml config (upload from $HOME)

      - name: Deploy Binaries
        uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: '${{ secrets.GITHUB_TOKEN }}'
          publish_dir: '.'
          force_orphan: true

Relevant log output

Run peaceiris/actions-gh-pages@v3
  with:
    github_token: ***
    publish_dir: .
    force_orphan: true
    publish_branch: gh-pages
    allow_empty_commit: false
    keep_files: false
    enable_jekyll: false
    disable_nojekyll: false
    exclude_assets: .github
[INFO] Usage https://github.com/peaceiris/actions-gh-pages#readme
Dump inputs
  [INFO] GithubToken: true
  [INFO] PublishBranch: gh-pages
  [INFO] PublishDir: .
  [INFO] DestinationDir: 
  [INFO] ExternalRepository: 
  [INFO] AllowEmptyCommit: false
  [INFO] KeepFiles: false
  [INFO] ForceOrphan: true
  [INFO] UserName: 
  [INFO] UserEmail: 
  [INFO] CommitMessage: 
  [INFO] FullCommitMessage: 
  [INFO] TagName: 
  [INFO] TagMessage: 
  [INFO] EnableJekyll (DisableNoJekyll): false
  [INFO] CNAME: 
  [INFO] ExcludeAssets .github
  
Setup auth token
  [INFO] setup GITHUB_TOKEN
Prepare publishing assets
  [INFO] ForceOrphan: true
  [INFO] chdir /home/runner/actions_github_pages_165[2](https://github.com/<user>/<repo>/runs/6440042743?check_suite_focus=true#step:4:2)606015746
  /usr/bin/git init
  hint: Using 'master' as the name for the initial branch. This default branch name
  hint: is subject to change. To configure the initial branch name to use in all
  hint: of your new repositories, which will suppress this warning, call:
  hint: 
  hint: 	git config --global init.defaultBranch <name>
  hint: 
  hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
  hint: 'development'. The just-created branch can be renamed via this command:
  hint: 
  hint: 	git branch -m <name>
  Initialized empty Git repository in /home/runner/actions_github_pages_1652606015746/.git/
  /usr/bin/git checkout --orphan gh-pages
  Switched to a new branch 'gh-pages'
  [INFO] prepare publishing assets
  [INFO] copy /home/runner/work/<repo>/<repo> to /home/runner/actions_github_pages_1652606015746
  cp: no such file or directory: /home/runner/work/<repo>/<repo>/.*
  [INFO] delete excluded assets
  rm: no paths given
  [INFO] Created /home/runner/actions_github_pages_1652606015746/.nojekyll
Setup Git config
  /usr/bin/git remote rm origin
  error: No such remote: 'origin'
  [INFO] The process '/usr/bin/git' failed with exit code 2
  /usr/bin/git remote add origin ***github.com/<user>/<repo>.git
  /usr/bin/git add --all
  /usr/bin/git config user.name <user>
  /usr/bin/git config user.email <user>@users.noreply.github.com
Create a commit
  /usr/bin/git commit -m deploy: ed[3](https://github.com/<user>/<repo>/runs/6440042743?check_suite_focus=true#step:4:3)c6fe3b6cdcc3350fc808187366df75c55b655
  [gh-pages (root-commit) dd83959] deploy: ed3c6fe3b6cdcc3350fc808187366df75c55b655
   3 files changed, 0 insertions(+), 0 deletions(-)
   create mode 1006[4](https://github.com/<user>/<repo>/runs/6440042743?check_suite_focus=true#step:4:4)4 .nojekyll
   create mode 100644 <large-file>
Push the commit or tag
  /usr/bin/git push origin --force gh-pages
  remote: error: Trace: 11e3e7b2a9ea8[5](https://github.com/<user>/<repo>/runs/6440042743?check_suite_focus=true#step:4:5)9a17c435ed9b5e2[6](https://github.com/<user>/<repo>/runs/6440042743?check_suite_focus=true#step:4:6)dece2e29[7](https://github.com/<user>/<repo>/runs/6440042743?check_suite_focus=true#step:4:7)1757[8](https://github.com/<user>/<repo>/runs/6440042743?check_suite_focus=true#step:4:8)b6f4bb[9](https://github.com/<user>/<repo>/runs/6440042743?check_suite_focus=true#step:4:9)503a737cc498b        
  remote: error: See http://git.io/iEPt8g for more information.        
  remote: error: File <large-file> is [10](https://github.com/<user>/<repo>/runs/6440042743?check_suite_focus=true#step:4:10)8.[69](https://github.com/<user>/<repo>/runs/6440042743?check_suite_focus=true#step:4:69) MB; this exceeds GitHub's file size limit of 100.00 MB        
  remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com./        
  To https://github.com/<user>/<repo>.git
   ! [remote rejected] gh-pages -> gh-pages (pre-receive hook declined)
  error: failed to push some refs to 'https://github.com/<user>/<repo>.git'
  Error: Action failed with "The process '/usr/bin/git' failed with exit code 1"

Additional context.

No response

Animeshz avatar May 15 '22 09:05 Animeshz

There is no way to push the files over 100MB to GitHub.

About large files on GitHub - GitHub Docs GitHub blocks pushes that exceed 100 MB.

I recommend you the approach like this: https://github.com/peaceiris/actions-gh-pages/pull/752

  • Upload the image/movie to an issue comment, and we will get the URL of the file
  • Load the image/movie with the URL

peaceiris avatar May 16 '22 14:05 peaceiris

This issue has been marked as inactive.

If you still encounter this or it has changed, add a comment to provide further information.

github-actions[bot] avatar Jun 02 '22 15:06 github-actions[bot]

@Animeshz I would be interested in you taking a look at #758 ?

AramZS avatar Jun 06 '22 14:06 AramZS

Please check out the following tips first!

Upload image/movie as githubusercontent

I recommend this approach again.

GitHub Pages does not support files under Git LFS

Note

  • Git LFS cannot be used with GitHub Pages sites.
  • Git LFS cannot be used with template repositories.

About Git Large File Storage - GitHub Docs

Downloading object under LFS

For downloading files under Git LFS, we can use the lfs option of the actions/checkout.

https://github.com/actions/checkout/blob/2541b1294d2704b0964813337f33b291d3f8596b/action.yml#L59-L61

- uses: actions/checkout@v3
  with:
    lfs: true

peaceiris avatar Jun 06 '22 14:06 peaceiris