Skip to content

Commit

Permalink
Add initial functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
sco1 committed Feb 21, 2024
1 parent 4e4aba7 commit dc32daf
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 72 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/lint_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Poetry for caching
run: pipx install poetry
- name: Set up Python
Expand All @@ -40,7 +40,7 @@ jobs:
fail-fast: false

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Poetry for caching
run: pipx install poetry

Expand All @@ -52,7 +52,7 @@ jobs:
cache: 'poetry'

- name: Set up (deadsnakes) Python ${{ matrix.python-version }}
uses: deadsnakes/action@v3.0.0
uses: deadsnakes/action@v3.1.0
if: endsWith(matrix.python-version, '-dev')
with:
python-version: ${{ matrix.python-version }}
Expand All @@ -66,7 +66,7 @@ jobs:
run: tox

- name: Cache coverage for ${{ matrix.python-version }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: cov_py${{ matrix.python-version }}
path: .coverage
Expand All @@ -76,14 +76,14 @@ jobs:
needs: test

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Pull coverage workflow artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
path: cov_cache/

Expand All @@ -101,7 +101,7 @@ jobs:
coverage html
- name: Publish cov HTML
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
path: htmlcov/
name: cov_report_html
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,18 @@
[![Code style: black](https://img.shields.io/badge/code%20style-black-black)](https://github.com/psf/black)

Randomly fail a pre-commit run

## Using pre-commit-fail-randomly with pre-commit
Add this to your `.pre-commit-config.yaml`

```yaml
repos:
- repo: https://github.com/sco1/pre-commit-fail-randomly
rev: v1.0.0
hooks:
- id: fail-randomly
```
## Hooks
### `fail-randomly`
Randomly fail your pre-commit pipeline. `fail-chance` may be optionally specified to change your failure chance (default: `0.05`). Ideally this is a float between `0` and `1`, inclusive, but you can do what you'd like and live with the consequences. If you specify a negative value then the universe has decided you get a 50/50 shot at failure.
Loading

0 comments on commit dc32daf

Please sign in to comment.