Skip to content

Commit f269d66

Browse files
Migrate to copier template for pre-commit-mirrors (#18)
* Migrate to copier template for pre-commit-mirrors --------- Co-authored-by: Pavel Zwerschke <pavelzw@gmail.com>
1 parent 8fb9a44 commit f269d66

11 files changed

+52
-47
lines changed

.copier-answers.yml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# This file is managed by Copier; DO NOT EDIT OR REMOVE.
2+
_commit: v0.1.7
3+
_src_path: git@github.com:quantco/copier-template-pre-commit-mirrors
4+
conda_package: insert-license-header
5+
description: This pre-commit hook automatically inserts our license header at the
6+
beginning of source code files tracked by Git.
7+
entry: insert-license --license-base64 Q29weXJpZ2h0IChjKSBRdWFudENvIHt5ZWFyX3N0YXJ0fS17eWVhcl9lbmR9ClNQRFgtTGljZW5zZS1JZGVudGlmaWVyOiBMaWNlbnNlUmVmLVF1YW50Q28K
8+
tool: insert-license-header
9+
url: https://github.com/thomasmarwitz/insert-license-header

.github/CODEOWNERS

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

.github/dependabot.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ updates:
33
- package-ecosystem: github-actions
44
directory: /
55
schedule:
6-
interval: weekly
6+
interval: monthly
77
reviewers:
88
- quantco/ci
99
groups:
1010
dependencies:
1111
patterns:
12-
- "*"
12+
- "*"

.github/workflows/autoupdate.yml

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
name: Autoupdate
2+
23
on:
34
workflow_dispatch:
45
schedule:
5-
- cron: "0 0 * * *"
6+
- cron: "0 0 * * 0"
67

78
defaults:
89
run:
@@ -16,8 +17,6 @@ jobs:
1617
steps:
1718
- name: Checkout branch
1819
uses: actions/checkout@v4
19-
with:
20-
ref: ${{ github.head_ref }}
2120
- name: Set up Conda env
2221
uses: mamba-org/setup-micromamba@8767fb704bd78032e9392f0386bf46950bdd1194
2322
with:
@@ -32,8 +31,8 @@ jobs:
3231
new_version=$(micromamba list -n check-env "$pkgname" --json | jq -r '.[0].version')
3332
if [[ "$new_version" != "$old_version" ]]; then
3433
sed -i "s/$old_version/$new_version/g" environment.yml
35-
echo "pkgname=$pkgname" >> "$GITHUB_OUTPUT"
36-
echo "new-version=$new_version" >> "$GITHUB_OUTPUT"
34+
echo "pkgname=$pkgname" >> $GITHUB_OUTPUT
35+
echo "new-version=$new_version" >> $GITHUB_OUTPUT
3736
fi
3837
- uses: peter-evans/create-pull-request@b1ddad2c994a25fbc81a28b3ec0e368bb2021c50
3938
if: steps.versions.outputs.pkgname
@@ -45,4 +44,4 @@ jobs:
4544
4645
This PR updates ${{ steps.versions.outputs.pkgname }} to version ${{ steps.versions.outputs.new-version }} and will push a tag on merge automatically.
4746
branch: v${{ steps.versions.outputs.new-version }}
48-
delete-branch: true
47+
delete-branch: true

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ jobs:
2323
- name: Check 'insert-license' executable is available
2424
run: |
2525
insert-license --help
26-
shell: bash -l {0}
26+
shell: bash -l {0}

.github/workflows/keep-alive.yml

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
name: Keep Repository Active
1+
name: Keep
22
on:
33
schedule:
4-
- cron: "0 6 * * SUN" # Once weekly on Sunday @ 0600 UTC
4+
- cron: 0 6 * * SUN
55

66
jobs:
7-
keep-alive: # Prevent cron jobs (in 'autoupdate.yml') from being suspended due to inactive repository
7+
keep-alive:
88
name: Alive
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v4
12-
- uses: gautamkrishnar/keepalive-workflow@5b3128727d02fe1a892d0a2987517c9ec8ca7425
13-
with:
14-
commit_message: "Ah ah ah, stayin' alive"
15-
committer_username: ForrestQuant
16-
committer_email: "forrestquant@users.noreply.github.com"
17-
time_elapsed: 50 # days
11+
- uses: actions/checkout@v4
12+
- uses: gautamkrishnar/keepalive-workflow@5b3128727d02fe1a892d0a2987517c9ec8ca7425
13+
with:
14+
commit_message: Ah ah ah, stayin' alive
15+
committer_username: ForrestQuant
16+
committer_email: forrestquant@users.noreply.github.com
17+
time_elapsed: 50 # days

.github/workflows/tag.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v4
13-
with:
14-
ref: ${{ github.head_ref }}
1513
- uses: Quantco/ui-actions/version-metadata@v1
1614
id: version-metadata
1715
with:
@@ -23,4 +21,4 @@ jobs:
2321
run: |
2422
version="${{ steps.version-metadata.outputs.newVersion }}"
2523
git tag "$version"
26-
git push origin "$version"
24+
git push origin "$version"

.pre-commit-hooks.yaml

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
- id: insert-license
2-
name: Insert license in comments
3-
description: "Insert a short license disclaimer as a header comment in source files"
4-
entry: insert-license --license-base64 Q29weXJpZ2h0IChjKSBRdWFudENvIHt5ZWFyX3N0YXJ0fS17eWVhcl9lbmR9ClNQRFgtTGljZW5zZS1JZGVudGlmaWVyOiBMaWNlbnNlUmVmLVF1YW50Q28K
5-
language: conda
6-
types: [text]
1+
- id: insert-license
2+
name: insert-license-header-conda
3+
description: 'This pre-commit hook automatically inserts our license header at the beginning of source code files tracked by Git.'
4+
entry: insert-license --license-base64 Q29weXJpZ2h0IChjKSBRdWFudENvIHt5ZWFyX3N0YXJ0fS17eWVhcl9lbmR9ClNQRFgtTGljZW5zZS1JZGVudGlmaWVyOiBMaWNlbnNlUmVmLVF1YW50Q28K
5+
language: conda
6+
types: [python]

LICENSE.txt LICENSE

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright 2023 QuantCo, Inc.
1+
Copyright 2024 QuantCo, Inc.
22

33
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
44

@@ -8,4 +8,4 @@ Redistribution and use in source and binary forms, with or without modification,
88

99
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.
1010

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.
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

+14-16
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
1-
## insert-license-header (-conda) mirror
1+
# insert-license-header pre-commit hook
22

3-
> [!NOTE]
4-
> To follow our pre-commit hook mirror convention, this repo has been rename: `pre-commit-insert-license` => `pre-commit-mirrors-insert-license`.
3+
pre-commit hook of insert-license-header with conda as a `language` / package manager.
54

6-
This pre-commit hook automatically inserts our license header at the beginning of source code files tracked by Git.
5+
For pre-commit: see [here](https://github.com/pre-commit/pre-commit)
76

8-
Usage: (in `.pre-commit-config.yaml`)
7+
For insert-license-header: see [here](https://github.com/thomasmarwitz/insert-license-header)
98

10-
```
11-
repos:
12-
- repo: https://github.com/Quantco/pre-commit-mirrors-insert-license
13-
rev: "1.1.0"
14-
hooks:
15-
- id: insert-license
16-
types: [python]
17-
args:
18-
- --dynamic-years
19-
- --comment-style
20-
- "#"
9+
## Using insert-license-header 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-insert-license-header
15+
rev: '' # Use the sha / tag you want to point at
16+
hooks:
17+
- id: insert-license-header-conda
2118
```
2219
2320
> [!WARNING]
@@ -52,3 +49,4 @@ To remove all license headers, temporarily add the `--remove-header` arg in
5249
your `.pre-commit-config.yaml`. Run the hook on all files: `pre-commit run insert-license -a`.
5350

5451
For more configuration options see the conda-packaged tool [insert-license-header](https://github.com/thomasmarwitz/insert-license-header) that exposes the `insert-license-header` executable, the original repository [Lucas-C/pre-commit-hooks](https://github.com/Lucas-C/pre-commit-hooks) and [Pre-Commit](https://pre-commit.com/).
52+

environment.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
channels:
22
- conda-forge
3+
- nodefaults
34
dependencies:
45
- insert-license-header=1.3.0

0 commit comments

Comments
 (0)