JamesIves/github-pages-deploy-action

Git config not found for centos:7

DifferentialOrange opened this issue · 2 comments

Describe the bug

Action fails to work in centos:7 container due to git config issues.

Reproduction Steps

Run action for a private repo inside the basic centos:7 container.

Logs

##[debug]Evaluating condition for step: 'Run actions/checkout@v3'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: Run actions/checkout@v3
##[debug]Register post job cleanup for action: actions/checkout@v3
##[debug]Loading inputs
##[debug]Evaluating: github.repository
##[debug]Evaluating Index:
##[debug]..Evaluating github:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'repository'
##[debug]=> 'myorg/mymodule'
##[debug]Result: 'myorg/mymodule'
##[debug]Evaluating: github.token
##[debug]Evaluating Index:
##[debug]..Evaluating github:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'token'
##[debug]=> '***'
##[debug]Result: '***'
##[debug]Loading env
Run actions/checkout@v3
  with:
    repository: myorg/mymodule
    token: ***
    ssh-strict: true
    persist-credentials: true
    clean: true
    sparse-checkout-cone-mode: true
    fetch-depth: 1
    fetch-tags: false
    lfs: false
    submodules: false
    set-safe-directory: true
  env:
    ROCK_NAME: mymodule
/usr/bin/docker exec  f85c2259b5f057b866180071fa30559e3f51380a70d22e50a4f3e9393ebcc7ee sh -c "cat /etc/*release | grep ^ID"
##[debug]ID="centos"
##[debug]ID_LIKE="rhel fedora"
##[debug]Running JavaScript Action with default external tool: node16
##[debug]GITHUB_WORKSPACE = '/__w/mymodule/mymodule'
##[debug]qualified repository = 'myorg/mymodule'
##[debug]ref = 'refs/heads/master'
##[debug]commit = '57d44cb8772ce1d5e92b8c0d08232a49c988f6fd'
##[debug]clean = true
##[debug]fetch depth = 1
##[debug]fetch tags = false
##[debug]lfs = false
##[debug]submodules = false
##[debug]recursive submodules = false
##[debug]GitHub Host URL = 
::add-matcher::/__w/_actions/actions/checkout/v3/dist/problem-matcher.json
##[debug]Added matchers: 'checkout-git'. Problem matchers scan action output for known warning or error strings and report these inline.
Syncing repository: myorg/mymodule
::group::Getting Git version info
Getting Git version info
  Working directory is '/__w/mymodule/mymodule'
  ##[debug]Getting git version
  /usr/bin/git version
  git version 1.8.3.1
  ##[debug]0
  ##[debug]git version 1.8.3.1
  ##[debug]
  ::endgroup::
Deleting the contents of '/__w/mymodule/mymodule'
The repository will be downloaded using the GitHub REST API
To create a local Git repository instead, add Git 2.18 or higher to the PATH
Downloading the archive
Writing archive to disk
Extracting the archive
/usr/bin/tar xz -C /__w/mymodule/mymodule/bda5dfe1-3b08-4b62-9308-7a11ec64b240 -f /__w/mymodule/mymodule/bda5dfe1-3b08-4b62-9308-7a11ec64b240.tar.gz
Resolved version myorg-mymodule-57d44cb8772ce1d5e92b8c0d08232a49c988f6fd
::remove-matcher owner=checkout-git::
##[debug]Removed matchers: 'checkout-git'
##[debug]Node Action run completed with exit code 0
##[debug]Save intra-action state isPost = true
##[debug]Finishing: Run actions/checkout@v3

##[debug]Evaluating condition for step: 'Publish generated API documentation to GitHub Pages'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: Publish generated API documentation to GitHub Pages
##[debug]Loading inputs
##[debug]Evaluating: github.token
##[debug]Evaluating Index:
##[debug]..Evaluating github:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'token'
##[debug]=> '***'
##[debug]Result: '***'
##[debug]Loading env
Run JamesIves/github-pages-deploy-action@v4.4.1
  with:
    branch: gh-pages
    folder: doc/apidoc
    token: ***
    clean: true
    force: true
  env:
    ROCK_NAME: mymodule
/usr/bin/docker exec  f85c2259b5f057b866180071fa30559e3f51380a70d22e50a4f3e9393ebcc7ee sh -c "cat /etc/*release | grep ^ID"
##[debug]ID="centos"
##[debug]ID_LIKE="rhel fedora"
##[debug]Running JavaScript Action with default external tool: node16

    ╭━━━╮╭╮╭╮╱╭╮╱╱╭╮╱╱╭━━━╮
    ┃╭━╮┣╯╰┫┃╱┃┃╱╱┃┃╱╱┃╭━╮┃
    ┃┃╱╰╋╮╭┫╰━╯┣╮╭┫╰━╮┃╰━╯┣━━┳━━┳━━┳━━╮
    ┃┃╭━╋┫┃┃╭━╮┃┃┃┃╭╮┃┃╭━━┫╭╮┃╭╮┃┃━┫━━┫
    ┃╰┻━┃┃╰┫┃╱┃┃╰╯┃╰╯┃┃┃╱╱┃╭╮┃╰╯┃┃━╋━━┃
    ╰━━━┻┻━┻╯╱╰┻━━┻━━╯╰╯╱╱╰╯╰┻━╮┣━━┻━━╯
    ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╭━╯┃
    ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╰━━╯
    ╭━━━╮╱╱╱╱╱╭╮╱╱╱╱╱╱╱╱╭━━━╮╱╱╭╮
    ╰╮╭╮┃╱╱╱╱╱┃┃╱╱╱╱╱╱╱╱┃╭━╮┃╱╭╯╰╮
    ╱┃┃┃┣━━┳━━┫┃╭━━┳╮╱╭╮┃┃╱┃┣━┻╮╭╋┳━━┳━╮
    ╱┃┃┃┃┃━┫╭╮┃┃┃╭╮┃┃╱┃┃┃╰━╯┃╭━┫┃┣┫╭╮┃╭╮╮
    ╭╯╰╯┃┃━┫╰╯┃╰┫╰╯┃╰━╯┃┃╭━╮┃╰━┫╰┫┃╰╯┃┃┃┃
    ╰━━━┻━━┫╭━┻━┻━━┻━╮╭╯╰╯╱╰┻━━┻━┻┻━━┻╯╰╯
    ╱╱╱╱╱╱╱┃┃╱╱╱╱╱╱╭━╯┃
    ╱╱╱╱╱╱╱╰╯╱╱╱╱╱╱╰━━╯
    

    💖 Support: https://github.com/sponsors/JamesIves
    📣 Maintained by James Ives: https://jamesiv.es

    🚀 Getting Started Guide: https://github.com/JamesIves/github-pages-deploy-action
    ❓ Discussions / Q&A: https://github.com/JamesIves/github-pages-deploy-action/discussions
    🔧 Report a Bug: https://github.com/JamesIves/github-pages-deploy-action/issues
Checking configuration and starting deployment… 🚦
Deploying using Deploy Token… 🔑
Configuring git…
/usr/bin/git config --global --add safe.directory /__w/mymodule/mymodule
/usr/bin/git config user.name DifferentialOrange
error: could not lock config file .git/config: No such file or directory
Error: There was an error initializing the repository: The process '/usr/bin/git' failed with exit code 255 ❌
Notice: Deployment failed! ❌
##[debug]Node Action run completed with exit code 1
##[debug]deployment_status='failed'
##[debug]Set output deployment-status = failed
##[debug]Finishing: Publish generated API documentation to GitHub Pages

Workflow

push-apidoc:
    runs-on: [self-hosted, Linux, x86_64, regular]
    container:
      image: centos:7

    steps:
      - name: Prepare the container
        run: yum install -y \
          autoconf \
          automake \
          build-essential \
          make \
          which \
          curl \
          gcc \
          gcc-c++ \
          git \
          libtool \
          rsync \
          sudo \
          tzdata \
          unzip \
          wget \
          binutils-devel \
          glibc-static \
          perl-IPC-Cmd |
          git

      - uses: actions/checkout@v3 # cannot use newer due to missing node20 support

      - name: Build API documentation
        run: make docs

      - name: Publish generated API documentation to GitHub Pages
        uses: JamesIves/github-pages-deploy-action@v4.4.1
        with:
          branch: gh-pages
          folder: doc/apidoc

I got a similar error on ubuntu-latest

Log:

    ╭━━━╮╭╮╭╮╱╭╮╱╱╭╮╱╱╭━━━╮
    ┃╭━╮┣╯╰┫┃╱┃┃╱╱┃┃╱╱┃╭━╮┃
    ┃┃╱╰╋╮╭┫╰━╯┣╮╭┫╰━╮┃╰━╯┣━━┳━━┳━━┳━━╮
    ┃┃╭━╋┫┃┃╭━╮┃┃┃┃╭╮┃┃╭━━┫╭╮┃╭╮┃┃━┫━━┫
    ┃╰┻━┃┃╰┫┃╱┃┃╰╯┃╰╯┃┃┃╱╱┃╭╮┃╰╯┃┃━╋━━┃
    ╰━━━┻┻━┻╯╱╰┻━━┻━━╯╰╯╱╱╰╯╰┻━╮┣━━┻━━╯
    ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╭━╯┃
    ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╰━━╯
    ╭━━━╮╱╱╱╱╱╭╮╱╱╱╱╱╱╱╱╭━━━╮╱╱╭╮
    ╰╮╭╮┃╱╱╱╱╱┃┃╱╱╱╱╱╱╱╱┃╭━╮┃╱╭╯╰╮
    ╱┃┃┃┣━━┳━━┫┃╭━━┳╮╱╭╮┃┃╱┃┣━┻╮╭╋┳━━┳━╮
    ╱┃┃┃┃┃━┫╭╮┃┃┃╭╮┃┃╱┃┃┃╰━╯┃╭━┫┃┣┫╭╮┃╭╮╮
    ╭╯╰╯┃┃━┫╰╯┃╰┫╰╯┃╰━╯┃┃╭━╮┃╰━┫╰┫┃╰╯┃┃┃┃
    ╰━━━┻━━┫╭━┻━┻━━┻━╮╭╯╰╯╱╰┻━━┻━┻┻━━┻╯╰╯
    ╱╱╱╱╱╱╱┃┃╱╱╱╱╱╱╭━╯┃
    ╱╱╱╱╱╱╱╰╯╱╱╱╱╱╱╰━━╯
    

    💖 Support: https://github.com/sponsors/JamesIves
    📣 Maintained by James Ives: https://jamesiv.es/

    🚀 Getting Started Guide: https://github.com/JamesIves/github-pages-deploy-action
    ❓ Discussions / Q&A: https://github.com/JamesIves/github-pages-deploy-action/discussions
    🔧 Report a Bug: https://github.com/JamesIves/github-pages-deploy-action/issues
Checking configuration and starting deployment… 🚦
Deploying using Deploy Token… 🔑
Configuring git…
/usr/bin/git config --global --add safe.directory /home/runner/work/clashJ/clashJ
/usr/bin/git config user.name MaicolAntali
/usr/bin/git config user.email 79454487+MaicolAntali@users.noreply.github.com
/usr/bin/git config core.ignorecase false
/usr/bin/git config --local --unset-all http.https://github.com/.extraheader
Unable to unset previous git config authentication as it may not exist, continuing…
/usr/bin/git remote rm origin
/usr/bin/git remote add origin ***github.com/MaicolAntali/clashJ.git
Git configured… 🔧
Starting to commit changes…
/usr/bin/git ls-remote --heads ***github.com/MaicolAntali/clashJ.git refs/heads/docs
f72f4884115bce0afbef45a2a40dac3c681f697c	refs/heads/docs
Creating worktree…
/usr/bin/git fetch --no-recurse-submodules --depth=1 origin docs
From https://github.com/MaicolAntali/clashJ
 * branch            docs       -> FETCH_HEAD
 * [new branch]      docs       -> origin/docs
/usr/bin/git worktree add --no-checkout --detach github-pages-deploy-action-temp-deployment-folder
Preparing worktree (detached HEAD be0bae7)
/usr/bin/git checkout -B docs origin/docs
Previous HEAD position was be0bae7 Update `docs.yaml` (#47)
Switched to a new branch 'docs'
branch 'docs' set up to track 'origin/docs'.
/usr/bin/chmod -R +rw /home/runner/work/clashJ/clashJ/clashJ/build/dokka/html
/usr/bin/rsync -q -av --checksum --progress /home/runner/work/clashJ/clashJ/clashJ/build/dokka/html/. github-pages-deploy-action-temp-deployment-folder --delete --exclude CNAME --exclude .nojekyll --exclude .ssh --exclude .git --exclude .github
Checking if there are files to commit…
/usr/bin/git add --all .
/usr/bin/git checkout -b github-pages-deploy-action/9g5h3smmv
Switched to a new branch 'github-pages-deploy-action/9g5h3smmv'
/usr/bin/git commit -m Deploying to docs from @ MaicolAntali/clashJ@be0bae7345fc88830ff5a2c0ea34dc41171502c6 🚀 --quiet --no-verify
Force-pushing changes...
/usr/bin/git push --force ***github.com/MaicolAntali/clashJ.git github-pages-deploy-action/9g5h3smmv:docs
remote: error: GH006: Protected branch update failed for refs/heads/docs.        
remote: error: 2 of 2 required status checks are expected.        
To https://github.com/MaicolAntali/clashJ.git
 ! [remote rejected] github-pages-deploy-action/9g5h3smmv -> docs (protected branch hook declined)
error: failed to push some refs to 'https://github.com/MaicolAntali/clashJ.git'
Running post deployment cleanup jobs… 🗑️
/usr/bin/git checkout -B github-pages-deploy-action/9g5h3smmv
Reset branch 'github-pages-deploy-action/9g5h3smmv'
/usr/bin/chmod -R +rw github-pages-deploy-action-temp-deployment-folder
/usr/bin/git worktree remove github-pages-deploy-action-temp-deployment-folder --force
Error: The deploy step encountered an error: The process '/usr/bin/git' failed with exit code 1 ❌
Notice: Deployment failed! ❌

Workflow file

name: "Generate docs"

on:
  push:
    branches:
      - main
    tags:
      - "*.*.*"

permissions:
  contents: write

jobs:
  generate:
    name: "Generating documentation with Dokka"
    runs-on: ubuntu-latest
    steps:
      - name: "🛎️ Checkout"
        uses: actions/checkout@v3
        with:
          persist-credentials: false

      - name: "⚙️ Set up JDK-17"
        uses: actions/setup-java@v3
        with:
          distribution: temurin
          java-version: 17

      - name: "🐘 Setup Gradle"
        uses: gradle/gradle-build-action@v2

      - name: "🔨 Build the docs"
        run: ./gradlew dokkaHtml

      - name: "🚀 Publish documentation"
        uses: JamesIves/github-pages-deploy-action@releases/v4
        with:
          BRANCH: docs
          FOLDER: clashJ/build/dokka/html

The action is primarily tested on Ubuntu, you may need to install Git or do some other types of configuration on the machine prior to running the action on something other.

@MaicolAntali This error isn't the same as the one in the original post. You're running into a branch protection issue - "remote: error: GH006: Protected branch update failed for refs/heads/docs."