Skip to content

Commit 21b83c1

Browse files
ci: add gha workflows
1 parent 581307f commit 21b83c1

4 files changed

Lines changed: 125 additions & 5 deletions

File tree

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

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: auto-format
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
7+
env:
8+
GH_TOKEN: ${{ github.token }}
9+
10+
permissions:
11+
contents: write
12+
pull-requests: write
13+
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.ref }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
auto-format:
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
if: github.event_name == 'pull_request'
25+
with:
26+
fetch-depth: 0
27+
ref: ${{ github.head_ref }}
28+
- uses: actions/checkout@v4
29+
if: github.event_name != 'pull_request'
30+
with:
31+
fetch-depth: 0
32+
ref: ${{ github.ref_name }}
33+
34+
- name: git config
35+
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
41+
42+
- name: commit & push
43+
run: |
44+
git add .
45+
git commit -m "ci: 🤖 auto-format" || echo "nothing to commit"
46+
git push || echo "nothing to push"
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: TechDev-project
2+
3+
on:
4+
issues:
5+
types:
6+
- opened
7+
pull_request:
8+
types:
9+
- opened
10+
11+
permissions:
12+
issues: write
13+
pull-requests: write
14+
contents: read
15+
16+
jobs:
17+
add-to-project:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Generate a token
21+
id: generate-token
22+
if: ${{ inputs.github-token == '' }}
23+
uses: actions/create-github-app-token@v2
24+
with:
25+
app-id: ${{ vars.CCBR_BOT_APP_ID }}
26+
private-key: ${{ secrets.CCBR_BOT_PRIVATE_KEY }}
27+
owner: CCBR
28+
29+
- uses: actions/add-to-project@v1.0.2
30+
with:
31+
project-url: https://github.com/orgs/CCBR/projects/17
32+
github-token: ${{ steps.generate-token.outputs.token }}
33+
34+
- name: add to MOSuite project
35+
uses: actions/add-to-project@v1.0.2
36+
with:
37+
project-url: https://github.com/orgs/CCBR/projects/32
38+
github-token: ${{ steps.generate-token.outputs.token }}

‎.github/workflows/test.yml‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: test
2+
3+
on:
4+
push:
5+
branches: [ main, dev ]
6+
pull_request:
7+
branches: [ main, dev ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
15+
- name: Parse environment.json and set Docker image
16+
id: docker_image
17+
run: |
18+
IMAGE=$(jq -r '.base_image' .codeocean/environment.json)
19+
IMAGE=${IMAGE//codeocean/nciccbr}
20+
echo "image=$IMAGE" >> $GITHUB_OUTPUT
21+
echo "Using Docker image: $IMAGE"
22+
23+
- name: Run tests in Docker
24+
run: |
25+
docker run --rm \
26+
-v ${{ github.workspace }}:/workspace \
27+
-w /workspace \
28+
${{ steps.docker_image.outputs.image }} \
29+
Rscript tests/testthat.R
Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Add to personal projects
1+
name: user-projects
22

33
on:
44
issues:
@@ -7,10 +7,17 @@ on:
77
pull_request:
88
types:
99
- assigned
10+
1011
permissions:
11-
issues: read
12-
pull-requests: read
12+
issues: write
13+
pull-requests: write
14+
1315
jobs:
1416
add-to-project:
15-
uses: CCBR/.github/.github/workflows/auto-add-user-project.yml@v0.1.0
16-
secrets: inherit
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: CCBR/actions/user-projects@main
20+
with:
21+
app-id: ${{ vars.CCBR_BOT_APP_ID }}
22+
app-private-key: ${{ secrets.CCBR_BOT_PRIVATE_KEY }}
23+
token-owner: "CCBR"

0 commit comments

Comments
 (0)