pre-commit-ci / issues

public issues for https://pre-commit.ci
17 stars 3 forks source link

Pre-commit ci says not a PR #209

Closed thesujai closed 6 months ago

thesujai commented 6 months ago

hey @asottile I was trying to run the pre-commit-ci lite if there is a comment /autofixme! in my PR. But the pre-commit ci skips saying not a PR. Here is the code:

name: Pre-commit CI
on:
  pull_request:
    types: [opened, synchronize, reopened, closed]
  issue_comment:
    types: [created]

jobs:
  main:
    name: "Pre-commit checks"
    if: github.event_name == 'pull_request' || (github.event_name == 'issue_comment' && contains(github.event.comment.body, '/autofixme!'))
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-python@v4
        with:
          python-version: 3.x
      - name: Install pre-commit
        run: pip install pre-commit

      - name: Run pre-commit
        run: pre-commit run --all-files --show-diff-on-failure

      - name: Run pre-commit-ci-lite
        uses: pre-commit-ci/lite-action@v1.0.2
        if: always()

Is there a way to fix this? Maybe it is getting triggered on event issue_comment but is there a way i can override this?

asottile commented 6 months ago

pre-commit ci lite is only supported on pull_request triggers (as the error message tells you!), it depends on some things that cannot work with issue trigger (not to mention it's more open to abuse / escalation)

thesujai commented 6 months ago

Thank you @asottile got it! My only reason of not using non lite version of pre-commit.ci is autoupdate_schedule that has to be defaulted to weekly. Is there any way to skip this autoupdate??

asottile commented 6 months ago

if you search here you'll find the answer why, though quarterly is usually a pretty good compromise for most

thesujai commented 6 months ago

Okay, Thank You!!!