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

Cannot read property 'slice' of null #71

Open
jorgev259 opened this issue Mar 12, 2022 · 3 comments
Open

Cannot read property 'slice' of null #71

jorgev259 opened this issue Mar 12, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@jorgev259
Copy link

jorgev259 commented Mar 12, 2022

Run s0/git-publish-subdir-action@develop

TypeError: Cannot read property 'slice' of null
at GitPackIndex.readSlice (/home/runner/work/_actions/s0/git-publish-subdir-action/develop/action/dist/index.js:20962:35)
at async readObjectPacked (/home/runner/work/_actions/s0/git-publish-subdir-action/develop/action/dist/index.js:21079:22)
at async _readObject (/home/runner/work/_actions/s0/git-publish-subdir-action/develop/action/dist/index.js:21121:14)
at async resolveCommit (/home/runner/work/_actions/s0/git-publish-subdir-action/develop/action/dist/index.js:28643:28)
at async _readCommit (/home/runner/work/_actions/s0/git-publish-subdir-action/develop/action/dist/index.js:28670:38)
at async _log (/home/runner/work/_actions/s0/git-publish-subdir-action/develop/action/dist/index.js:28805:17)
at async Object.log (/home/runner/work/_actions/s0/git-publish-subdir-action/develop/action/dist/index.js:28973:12)
at async getGitInformation (/home/runner/work/_actions/s0/git-publish-subdir-action/develop/action/dist/index.js:12804:24)
at async main (/home/runner/work/_actions/s0/git-publish-subdir-action/develop/action/dist/index.js:12823:21) {
caller: 'git.log'
}

The workflow file being used is https://github.com/jorgev259/silentwalker_gallery_rework/blob/main/.github/workflows/build-gh-pages.yml

@s0 s0 added the bug Something isn't working label Mar 12, 2022
@laszlo-san
Copy link

We managed to work around this by createing a simple bash script, this is not a bugfix for this repo tough.

We crated a push.sh file with content:

#!/bin/bash
# process flags (WARNING: no error handling if not provided!)
while getopts b:f:m: flag
do
    case "${flag}" in
        b) branch=${OPTARG};;
        f) folder=${OPTARG};;
        m) message=${OPTARG};;
    esac
done

# git setup
git --version;
git config user.name "GitHub Actions Bot";
git config user.email "<>";

# get the last commit basic data
hash=$(git log -1 --pretty=%h);
old_subject=$(git log -1 --pretty=%s);


find -maxdepth 1 -mindepth 1 -type d,f -regextype posix-egrep -not -regex "./($folder.{0,}|.git|.git/.{0,})" -exec rm -rf "{}" +;
mv ./"$folder"/* .;
rm -rf ./"$folder"/;
git fetch --all;
git switch -C temporary;
git add -A;
git commit -m "Temporary commit";
git checkout -B "$branch";
git reset --hard origin/"$branch";
git checkout temporary ./;
git add -A;
git commit -m "($hash) $old_subject" -m "$message";
git push origin "$branch";

and modified the action like this:

name: Generate a build and push to build branch

on:
  push:
    branches:
      - main

jobs:
  build:
    runs-on: ubuntu-latest
    name: Build and Push
    steps:
      - name: Use Node.js 16
        uses: actions/setup-node@v1
        with:
          node-version: 16
        
      - name: git-checkout
        uses: actions/checkout@v2

      - name: Run build script
        run: ./gh-action-build.sh

      - name: Push to Build
        shell: bash
        run: ./push.sh -b build -f build -m "Automated build"


@zwippie
Copy link

zwippie commented Mar 30, 2023

@laszlo-san Just had the exact same error while deploying. Do you have any pointers to why this is happening?

@laszlo-san
Copy link

@zwippie The action script uses an older node version, or Github gives different properties now to actions and this repo does not updated accordingly? Can't really tell.
In any case we could not go deeper or had the time to debug, hence we had to implement a different aproach.

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