Skip to content

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

@Animeshz

Description

@Animeshz

Checklist

  • I am using the latest version of this action.
  • I have read the latest README and followed the instructions.
  • 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

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions