Skip to content

Commit 66f6d62

Browse files
ci: update gha workflows from template repo (#6)
* refactor: load local MOSuite * Squashed 'code/MOSuite/' content from commit c09ee39 git-subtree-dir: code/MOSuite git-subtree-split: c09ee39f9b282237f13d88dcf4cdfed965209c68 * ci: update workflows from template
1 parent baad507 commit 66f6d62

9 files changed

Lines changed: 99 additions & 23 deletions

File tree

‎.github/WORDLIST.txt‎

Whitespace-only changes.

‎.github/workflows/auto-format.yml‎

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,45 @@ name: auto-format
33
on:
44
workflow_dispatch:
55
pull_request:
6+
branches: [dev, main]
67

7-
env:
8-
GH_TOKEN: ${{ github.token }}
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
911

1012
permissions:
1113
contents: write
1214
pull-requests: write
1315

14-
concurrency:
15-
group: ${{ github.workflow }}-${{ github.ref }}
16-
cancel-in-progress: true
17-
1816
jobs:
1917
auto-format:
2018
runs-on: ubuntu-latest
2119

2220
steps:
23-
- uses: actions/checkout@v4
24-
if: github.event_name == 'pull_request'
21+
- name: Generate a token
22+
id: generate-token
23+
uses: actions/create-github-app-token@v2
2524
with:
26-
fetch-depth: 0
27-
ref: ${{ github.head_ref }}
28-
- uses: actions/checkout@v4
29-
if: github.event_name != 'pull_request'
25+
app-id: ${{ vars.CCBR_BOT_APP_ID }}
26+
private-key: ${{ secrets.CCBR_BOT_PRIVATE_KEY }}
27+
owner: ${{ github.repository_owner }}
28+
29+
- uses: actions/checkout@v7
3030
with:
31-
fetch-depth: 0
32-
ref: ${{ github.ref_name }}
31+
token: ${{ steps.generate-token.outputs.token }}
32+
ref: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }}
3333

3434
- name: git config
3535
run: |
36-
git config --global user.name "github-actions[bot]"
37-
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
38-
39-
- name: Format R code with air
40-
uses: rstudio/shiny-workflows/format-r-code@v1
36+
git config --global user.name "CCBR-bot"
37+
git config --global user.email "258092125+ccbr-bot@users.noreply.github.com"
4138
39+
- name: format
40+
uses: pre-commit/action@v3.0.1
41+
continue-on-error: true
4242
- name: commit & push
43+
if: ${{ github.event_name == 'pull_request' }}
4344
run: |
4445
git add .
45-
git commit -m "ci: 🤖 auto-format" || echo "nothing to commit"
46+
git commit -m "ci: 🤖 auto-format with pre-commit" || echo "nothing to commit"
4647
git push || echo "nothing to push"

‎.github/workflows/tests.yml‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,19 @@ name: tests
22

33
on:
44
push:
5-
branches: [ main, dev ]
5+
branches: [main, dev]
66
pull_request:
7-
branches: [ main, dev ]
7+
branches: [main, dev]
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
812

913
jobs:
1014
tests:
1115
runs-on: ubuntu-latest
1216
steps:
13-
- uses: actions/checkout@v3
17+
- uses: actions/checkout@v7
1418

1519
- name: Parse environment.json and set Docker image
1620
id: docker_image

‎.pre-commit-config.yaml‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
default_install_hook_types: [pre-commit, commit-msg]
2+
default_stages: [pre-commit]
3+
exclude: |
4+
(?x)(
5+
^.codeocean/|
6+
^environment/|
7+
^metadata/|
8+
^code/MOSuite|
9+
^code/SCWorkflow|
10+
^code/OMIX*
11+
)
12+
13+
repos:
14+
- repo: https://github.com/pre-commit/pre-commit-hooks
15+
rev: v6.0.0
16+
hooks:
17+
- id: check-added-large-files
18+
args: ["--maxkb=10240"]
19+
- id: end-of-file-fixer
20+
- id: trailing-whitespace
21+
- id: check-json
22+
# spell check
23+
- repo: https://github.com/codespell-project/codespell
24+
rev: v2.4.2
25+
hooks:
26+
- id: codespell
27+
args:
28+
[ -I, .github/WORDLIST.txt ]
29+
# R formatting
30+
- repo: https://github.com/posit-dev/air-pre-commit
31+
rev: 0.10.0
32+
hooks:
33+
- id: air-format
34+
- repo: https://github.com/lorenzwalthert/precommit
35+
rev: v0.4.3.9028
36+
hooks:
37+
- id: parsable-R
38+
# Python formatting
39+
- repo: https://github.com/astral-sh/ruff-pre-commit
40+
rev: v0.15.16
41+
hooks:
42+
- id: ruff-check
43+
args: [--fix]
44+
- id: ruff-format
45+
46+
# enforce conventional commit format
47+
- repo: https://github.com/compilerla/conventional-pre-commit
48+
rev: v4.4.0
49+
hooks:
50+
- id: conventional-pre-commit
51+
stages: [commit-msg]
52+
args: []
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
any::ggplot2@3.5.2
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"recommendations": [
3+
"Posit.air-vscode"
4+
]
5+
}

‎code/MOSuite/.vscode/settings.json‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"[r]": {
3+
"editor.formatOnSave": true,
4+
"editor.defaultFormatter": "Posit.air-vscode"
5+
},
6+
"[quarto]": {
7+
"editor.formatOnSave": true,
8+
"editor.defaultFormatter": "quarto.quarto"
9+
},
10+
"chat.tools.terminal.autoApprove": {
11+
"timeout": true
12+
}
13+
}
904 KB
Loading

‎code/MOSuite/man/figures/logo.png‎

33.4 KB
Loading

0 commit comments

Comments
 (0)