JamesIves/github-pages-deploy-action

Deployment failed with Exit code 128

zbw182 opened this issue · 5 comments

Describe the bug

Ran into this issue when updating our site and redeploying

Error: The deploy step encountered an error: There was an error creating the worktree: The process '/usr/bin/git' failed with exit code 128 ❌ ❌

Reproduction Steps

Merged in some changes, and the redeployment failed. We're most likely doing something silly here, but I'm not familiar enough with the how the deployment process works to see any obvious issues.

This line looks suspicious

fatal: 'master' is already used by worktree at '/home/runner/work/ota-analyzer/ota-analyzer'

Logs

Checking configuration and starting deployment… 🚦
Configuring SSH client… 🔑
Identity added: (stdin) (zhangkelvin@zhangkelvin-macbookpro.roam.corp.google.com)
Deploying using SSH Deploy Key… 🔑
Configuring git…
/usr/bin/git config user.name zhangxp1998
/usr/bin/git config user.email zhangxp1998@gmail.com
/usr/bin/git remote rm origin
/usr/bin/git remote add origin git@github.com:android/android.github.io
Git configured… 🔧
Starting to commit changes…
/usr/bin/git ls-remote --heads git@github.com:android/android.github.io refs/heads/master
e6f43fbe6c548418679eb0fea070c40b96978949 refs/heads/master
Creating worktree…
/usr/bin/git fetch --no-recurse-submodules --depth=1 origin master
From github.com:android/android.github.io

  • branch master -> FETCH_HEAD
  • [new branch] master -> origin/master
    /usr/bin/git worktree add --no-checkout --detach github-pages-deploy-action-temp-deployment-folder
    Preparing worktree (detached HEAD 717bdd3)
    /usr/bin/git checkout -B master origin/master
    fatal: 'master' is already used by worktree at '/home/runner/work/ota-analyzer/ota-analyzer'
    Running post deployment cleanup jobs… 🗑️
    /usr/bin/git checkout -B github-pages-deploy-action/nacfo11fk
    Switched to a new branch 'github-pages-deploy-action/nacfo11fk'
    /usr/bin/git worktree remove github-pages-deploy-action-temp-deployment-folder --force
    Error: The deploy step encountered an error: There was an error creating the worktree: The process '/usr/bin/git' failed with exit code 128 ❌ ❌
    Deployment failed! ❌

::set-output name=deployment-status::failed

Workflow

name: Node.js CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest

strategy:
  matrix:
    node-version: [16.x]
    # See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
  uses: actions/setup-node@v2
  with:
    node-version: ${{ matrix.node-version }}
    cache: 'npm'
- run: npm ci --force
- run: NODE_ENV=production npm run build --if-present
- name: Deploy to GitHub Pages
  uses: JamesIves/github-pages-deploy-action@4.1.5
  with:
    branch: 'master'
    folder: 'dist'
    ssh-key: '${{ secrets.SSH_KEY }}'
    clean: false
    repository-name: 'android/android.github.io'
    target-folder: 'analyseOTA'

Additional Comments

Please upgrade to 4.6.1 as this issue was resolved in that version - https://github.com/JamesIves/github-pages-deploy-action/releases/tag/v4.6.1

runs-on: ubuntu-latest

strategy:
  matrix:
    node-version: [16.x]
    # See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
  uses: actions/setup-node@v2
  with:
    node-version: ${{ matrix.node-version }}
    cache: 'npm'
- run: npm ci --force
- run: NODE_ENV=production npm run build --if-present
- name: Deploy to GitHub Pages
  uses: JamesIves/github-pages-deploy-action@4.6.1
  with:
    branch: 'master'
    folder: 'dist'
    ssh-key: '${{ secrets.SSH_KEY }}'
    clean: false
    repository-name: 'android/android.github.io'
    target-folder: 'analyseOTA'

adding the above to .github/workflows/github-actions-demo.yml results in

Error: Unable to resolve action `jamesives/github-pages-deploy-action@4.6.1`, unable to find version `4.6.1`

Any idea what's going on here : )

You need to add the letter "v" to version:
JamesIves/github-pages-deploy-action@v4.6.1
And also, сheck that "Read and write permissions" are enabled in "Settings -> Actions -> General -> Workflow permissions".

Thanks @SergeyFi - my bad on the typo

For context that version corresponds to a tag, you can find the full list of available ones here: https://github.com/JamesIves/github-pages-deploy-action/tags

I had the same error last night. In my case I solved it another way.

Go to Developer Settings and create personal access token and then select the repository you want.
Don't forget to check read and write under the repository permissions for contents.
It's very important.

I hope my case can be helpful for other people. 🙏