Giter VIP home page Giter VIP logo

Comments (16)

asottile avatar asottile commented on September 7, 2024

the "push back" behaviour is only enabled for pull requests, not pushes directly to breanches

from action.

BastianZim avatar BastianZim commented on September 7, 2024

Sorry, copied that incorrectly, it's launched on pull_request.

from action.

BastianZim avatar BastianZim commented on September 7, 2024

@asottile

Apologies about that, I copied the old file, the correct formatting was:

name: pre-commit

on:
  pull_request:

jobs:
  pre-commit:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
      with:
        fetch-depth: 0
    - uses: actions/setup-python@v2
      with: 
        python-version: '3.8'
    - uses: pre-commit/[email protected]
      with:
        token: ${{ secrets.GITHUB_TOKEN }}

from action.

asottile avatar asottile commented on September 7, 2024

is the pull request from a fork maybe?

from action.

BastianZim avatar BastianZim commented on September 7, 2024

No, everything belongs to me.

from action.

BastianZim avatar BastianZim commented on September 7, 2024

The repo belongs to an organisation that I belong to, could that be the problem?

from action.

asottile avatar asottile commented on September 7, 2024

can you show me a screenshot of the title portion of the PR? it should show where the branch is coming from and going to and that will help me debug

from that configuration, the only explanation that I have is that secrets are not enabled because it is an outside pull request (even if you own both of the repositories) -- github will only give secrets to PRs coming from the repository itself

from action.

BastianZim avatar BastianZim commented on September 7, 2024

I think somehow the fact that this is not a pull request is not correctly sent to the action but not sure how to correct that.

from action.

asottile avatar asottile commented on September 7, 2024

ah actually I think I know what's happening here

if pre-commit fails on the second invocation it can't push to the branch because github actions does not fire on pushes made by github actions -- so instead it marks the job as failed

I notice you also have both double-quote-string-fixer and black -- the two tools disagree on formatting of strings unless you pass -S (skip-string-normalization) to black and so your job will always fail

from action.

BastianZim avatar BastianZim commented on September 7, 2024

Yes, that's it, thank you!!! I was racking my brain...

It's not fully working, now it's failing with

! [remote rejected] HEAD -> test-2 (refusing to allow a GitHub App to create or update workflow `.github/workflows/pre-commit.yml` without `workflows` permission)

since it also updates the workflow file but I'll try to exclude that file and then it should work.

Thanks again for the help and the tool!

from action.

asottile avatar asottile commented on September 7, 2024

ah yeah, I've run into that too, I actually don't know any solutions to that via github actions -- it'll work with https://pre-commit.ci though (coming soon!)

from action.

BastianZim avatar BastianZim commented on September 7, 2024

Is there any way I can tell pre-commit to ignore files or should I try to do that in the action?

That CI looks awesome though, seriously helpful!

from action.

asottile avatar asottile commented on September 7, 2024

either top level exclude or hook level exclude

from action.

BastianZim avatar BastianZim commented on September 7, 2024

Awesome, thank you!

from action.

BastianZim avatar BastianZim commented on September 7, 2024

Would you mind if I would include that in the readme of this project?
Seems like something that others might face as well.

from action.

asottile avatar asottile commented on September 7, 2024

sure

from action.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.