Skip to content

Ci/enforce #6

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

Merged
merged 3 commits into from
Apr 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 30 additions & 2 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Pre-commit check

on:
pull_request:
types: [opened, reopened, synchronize, labeled]
pull_request_target:
types: [opened, reopened, synchronize, labeled, unlabeled]

jobs:
lint:
Expand Down Expand Up @@ -60,3 +60,31 @@ jobs:
if: always()
with:
msg: "ci(pre-commit): Apply automatic fixes"

report-run:
name: Check if the PR has run the pre-commit checks
permissions:
statuses: write
needs: lint
if: always()
runs-on: ubuntu-latest
steps:
- name: Report success
if: |
contains(github.event.pull_request.labels.*.name, 'Status: Pending Merge') &&
needs.lint.result == 'success'
uses: conda/actions/[email protected]
with:
context: pre-commit-result
state: success
description: All pre-commit checks passed

- name: Report pending
if: |
!contains(github.event.pull_request.labels.*.name, 'Status: Pending Merge') ||
needs.lint.result == 'failure'
uses: conda/actions/[email protected]
with:
context: pre-commit-result
state: pending
description: The pre-commit checks need to be successful before merging