Skip to content

Commit c5e2670

Browse files
committed
Initial commit
0 parents  commit c5e2670

14 files changed

+183
-0
lines changed

.copier-answers.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# This file is managed by Copier; DO NOT EDIT OR REMOVE.
2+
_commit: v0.1.9-16-g2ebc061
3+
_src_path: git@github.com:quantco/copier-template-pre-commit-mirrors
4+
conda_package: taplo
5+
description: 'A TOML toolkit written in Rust'
6+
entry: taplo format
7+
tool: taplo
8+
url: https://github.com/tamasfe/taplo

.github/CODEOWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @quantco/ci

.github/ISSUE_TEMPLATE/config.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
blank_issues_enabled: false
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
name: New issue
3+
about: Create a new issue
4+
---
5+
6+
<!-- ⚠️ This is an open-source repository. Do not share sensitive information. -->

.github/PULL_REQUEST_TEMPLATE.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<!-- ⚠️ This is an open-source repository. Do not share sensitive information. -->

.github/workflows/autoupdate.yml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Autoupdate
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: "0 0 * * 0"
7+
8+
defaults:
9+
run:
10+
shell:
11+
bash -el {0}
12+
13+
jobs:
14+
check_update:
15+
name: Check if newer version exists
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout branch
19+
uses: actions/checkout@v4
20+
- name: Set up Conda env
21+
uses: mamba-org/setup-micromamba@422500192359a097648154e8db4e39bdb6c6eed7
22+
with:
23+
environment-file: environment.yml
24+
environment-name: check-env
25+
- name: Find latest version
26+
id: versions
27+
run: |
28+
pkgname="$(yq '.dependencies[0]' environment.yml | grep -Eio '[a-z0-9_-]+' | head -n 1)"
29+
old_version=$(micromamba list -n check-env "$pkgname" --json | jq -r '.[0].version')
30+
micromamba update -y -n check-env -a
31+
new_version=$(micromamba list -n check-env "$pkgname" --json | jq -r '.[0].version')
32+
if [[ "$new_version" != "$old_version" ]]; then
33+
sed -i "s/$old_version/$new_version/g" environment.yml
34+
echo "pkgname=$pkgname" >> $GITHUB_OUTPUT
35+
echo "new-version=$new_version" >> $GITHUB_OUTPUT
36+
fi
37+
- uses: peter-evans/create-pull-request@6d6857d36972b65feb161a90e484f2984215f83e
38+
if: steps.versions.outputs.pkgname
39+
with:
40+
commit-message: "Update ${{ steps.versions.outputs.pkgname }} to ${{ steps.versions.outputs.new-version }}"
41+
title: "Update ${{ steps.versions.outputs.pkgname }} to ${{ steps.versions.outputs.new-version }}"
42+
body: |
43+
A new release of ${{ steps.versions.outputs.pkgname }} was detected on conda-forge.
44+
45+
This PR updates ${{ steps.versions.outputs.pkgname }} to version ${{ steps.versions.outputs.new-version }} and will push a tag on merge automatically.
46+
branch: v${{ steps.versions.outputs.new-version }}
47+
delete-branch: true

.github/workflows/ci.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
pre-commit-checks:
11+
name: Pre-commit Checks
12+
timeout-minutes: 30
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout branch
16+
uses: actions/checkout@v4
17+
with:
18+
ref: ${{ github.head_ref }}
19+
- name: Run pre-commit-conda
20+
uses: quantco/pre-commit-conda@v1
21+
env:
22+
name: Test env
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Checkout branch
26+
uses: actions/checkout@v4
27+
with:
28+
ref: ${{ github.head_ref }}
29+
- name: Set up Conda env
30+
uses: mamba-org/setup-micromamba@422500192359a097648154e8db4e39bdb6c6eed7
31+
with:
32+
environment-file: environment.yml
33+
environment-name: test-env

.github/workflows/keep-alive.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Keep
2+
on:
3+
schedule:
4+
- cron: 0 6 * * SUN
5+
6+
jobs:
7+
keep-alive:
8+
name: Alive
9+
runs-on: ubuntu-latest
10+
permissions:
11+
actions: write
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: gautamkrishnar/keepalive-workflow@7fa96d25d8e4c2811d5405d6328111f1ef548246

.github/workflows/tag.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Tag on version bump
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
tag:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: Quantco/ui-actions/version-metadata@v1
14+
id: version-metadata
15+
with:
16+
file: environment.yml
17+
token: ${{ secrets.GITHUB_TOKEN }}
18+
version-extraction-override: 'regex:\s+- taplo=(\d+.\d+.\d+)'
19+
- name: Bump tag
20+
if: steps.version-metadata.outputs.changed == 'true'
21+
run: |
22+
version="${{ steps.version-metadata.outputs.newVersion }}"
23+
git tag "$version"
24+
git push origin "$version"

.pre-commit-config.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
exclude: ^\.copier-answers\.yml$
2+
repos:
3+
- repo: https://github.com/Quantco/pre-commit-mirrors-pre-commit-hooks
4+
rev: 4.5.0
5+
hooks:
6+
- id: trailing-whitespace-conda
7+
- id: end-of-file-fixer-conda
8+
- id: check-merge-conflict-conda
9+
args: ["--assume-in-merge"]

.pre-commit-hooks.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
- id: taplo-conda
2+
name: taplo-conda
3+
description: 'A TOML toolkit written in Rust'
4+
entry: taplo format
5+
language: conda

LICENSE

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Copyright 2024 QuantCo, Inc.
2+
3+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4+
5+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6+
7+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8+
9+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10+
11+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# taplo pre-commit hook
2+
3+
pre-commit hook of taplo with conda as a `language` / package manager.
4+
5+
For pre-commit: see [here](https://github.com/pre-commit/pre-commit)
6+
7+
For taplo: see [here](https://github.com/tamasfe/taplo)
8+
9+
## Using taplo with pre-commit and conda:
10+
11+
Add this to your `.pre-commit-config.yaml`
12+
13+
```yaml
14+
- repo: https://github.com/quantco/pre-commit-mirrors-taplo
15+
rev: '' # Use the sha / tag you want to point at
16+
hooks:
17+
- id: taplo-conda
18+
```

environment.yml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
channels:
2+
- conda-forge
3+
- nodefaults
4+
dependencies:
5+
- taplo=0.9.1

0 commit comments

Comments
 (0)