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

git exits with 128 in my action #183

Closed
asm0dey opened this issue Jan 23, 2023 · 3 comments · Fixed by #200
Closed

git exits with 128 in my action #183

asm0dey opened this issue Jan 23, 2023 · 3 comments · Fixed by #200

Comments

@asm0dey
Copy link

asm0dey commented Jan 23, 2023

Behaviour

Steps to reproduce this issue

  1. In the repo https://github.com/asm0dey/kotlin-spring-webinar
  2. On the "Deploy pages step"
  3. I get the following log:
  ##[debug]Force push
  /usr/bin/git push --force ***github.com/asm0dey/kotlin-spring-webinar.git gh-pages
  remote: Permission to asm0dey/kotlin-spring-webinar.git denied to github-actions[bot].
  fatal: unable to access 'https://github.com/asm0dey/kotlin-spring-webinar.git/': The requested URL returned error: 403
  Error: The process '/usr/bin/git' failed with exit code 128
  ##[debug]Node Action run completed with exit code 1
  ##[debug]Finishing: Deploy pages

Expected behaviour

should be published successfully

Configuration

name: Deploy pages
on: push
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: '19'
      - name: Install dependencies
        run: npm install
      - name: Install slidev
        run:  npm i -g @slidev/cli
      - name: Build
        run: slidev build --base kotlin-spring-webinar
      - name: Deploy pages
        uses: crazy-max/ghaction-github-pages@v3
        with:
          build_dir: dist
          target_branch: gh-pages
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@MohnishKalia
Copy link

Was running into this issue as well and believe I have found a fix. The default GITHUB_TOKEN secret for the action doesn't appear to have the permission to write to the contents of the repository. Adding the following to the top of the action below name: fixed it for me.

permissions: 
  contents: write

@DarrenDanielDay
Copy link

Here's the doc:

https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#setting-the-permissions-of-the-github_token-for-your-repository

Adding permission in the config file works, and you can also modify the GitHub Actions settings of your repository to enable write permissions without modifying the config file.

image

@asm0dey
Copy link
Author

asm0dey commented Jan 26, 2023

Thanks folks! Probably it should be added into the doc (or did I miss it?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants