Skip to content
Merged
Show file tree
Hide file tree
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
30 changes: 30 additions & 0 deletions .github/template-sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Note: SciTools/cartopy is managed by a separate development team so is not
# included in the templating.

SciTools/cf-units:
- source: templates/.pre-commit-config.yaml
dest: .pre-commit-config.yaml
SciTools/iris:
- source: templates/.pre-commit-config.yaml
dest: .pre-commit-config.yaml
SciTools/iris-grib:
- source: templates/.pre-commit-config.yaml
dest: .pre-commit-config.yaml
SciTools/mo_pack:
- source: templates/.pre-commit-config.yaml
dest: .pre-commit-config.yaml
SciTools/nc-time-axis:
- source: templates/.pre-commit-config.yaml
dest: .pre-commit-config.yaml
SciTools/python-stratify:
- source: templates/.pre-commit-config.yaml
dest: .pre-commit-config.yaml
SciTools/tephi:
- source: templates/.pre-commit-config.yaml
dest: .pre-commit-config.yaml
SciTools/test-iris-imagehash:
- source: templates/.pre-commit-config.yaml
dest: .pre-commit-config.yaml
SciTools/workflows:
- source: templates/.pre-commit-config.yaml
dest: .pre-commit-config.yaml
30 changes: 30 additions & 0 deletions .github/workflows/template-sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Sync template files across repos
on:
schedule:
# "At 02:00 on day-of-month 1 in every 2nd month."
- cron: '0 2 1 */2 *'
workflow_dispatch:

jobs:
sync:
if: "github.repository_owner == 'SciTools' || github.event_name == 'workflow_dispatch'"
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- id: generate-token
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.AUTH_APP_ID }}
private_key: ${{ secrets.AUTH_APP_PRIVATE_KEY }}

- uses: BetaHuhn/repo-file-sync-action@3023dac7ce66c18b119e2012348437eadeaea116
with:
GH_INSTALLATION_TOKEN: ${{ steps.generate-token.outputs.token }}
CONFIG_PATH: .github/template-sync.yml
PR_LABELS: |
Bot
Type: Infrastructure
COMMIT_PREFIX: "👁 TEMPLATE DEVIATIONS:"
PR_BODY: "## Please read: https://github.com/SciTools/.github/tree/main/templates"
68 changes: 68 additions & 0 deletions templates/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks

files: |
(?x)(
noxfile\.py|
setup\.py|
docs\/.+\.py|
benchmarks\/.+\.py|
)
minimum_pre_commit_version: 1.21.0

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
# Prevent giant files from being committed.
- id: check-added-large-files
# Check whether files parse as valid Python.
- id: check-ast
# Check for file name conflicts on case-insensitive filesytems.
- id: check-case-conflict
# Check for files that contain merge conflict strings.
- id: check-merge-conflict
# Check for debugger imports and py37+ `breakpoint()` calls in Python source.
- id: debug-statements
# Don't commit to main branch.
- id: no-commit-to-branch

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.3.4"
hooks:
- id: ruff
types: [file, python]
args: [--fix, --show-fixes]
- id: ruff-format
types: [file, python]

- repo: https://github.com/codespell-project/codespell
rev: "v2.2.6"
hooks:
- id: codespell
types_or: [asciidoc, python, markdown, rst]
additional_dependencies: [tomli]

- repo: https://github.com/PyCQA/flake8
rev: 7.0.0
hooks:
- id: flake8
types: [file, python]

- repo: https://github.com/asottile/blacken-docs
rev: 1.16.0
hooks:
- id: blacken-docs
types: [file, rst]

- repo: https://github.com/aio-libs/sort-all
rev: v1.2.0
hooks:
- id: sort-all
types: [file, python]

- repo: https://github.com/numpy/numpydoc
rev: v1.7.0
hooks:
- id: numpydoc-validation
types: [file, python]
19 changes: 19 additions & 0 deletions templates/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
These files are templates defining the standard format across all SciTools
repos. Repo deviations from template are periodically identified in pull
requests by the repo-file-sync-action.

### Possible actions on a deviation pull request

- ✔️ **Merge** - all deviations are re-aligned with the template
(E.g. the repo is simply out of date and needs updating).
- ❌ **Close** - all deviations are kept
(E.g. all deviations are required repo-specific detail).
- ️️✏️ **Edit** - re-align some deviations, keep others.
- 🏃 **Close then action independently**
(E.g. the repo contains content that should be added to the template).

### Further reading

- https://github.com/marketplace/actions/repo-file-sync-action
- [../.github/workflows/template-sync.yml](../.github/workflows/template-sync.yml)
- [../.github/template-sync.yml](../.github/template-sync.yml)