Skip to content

Commit 8226bec

Browse files
committed
Split the style and document actions
1 parent dcad13d commit 8226bec

File tree

3 files changed

+70
-49
lines changed

3 files changed

+70
-49
lines changed

.github/workflows/phs_style_and_document.yaml renamed to .github/workflows/phs_document.yaml

Lines changed: 4 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -3,55 +3,15 @@
33
on:
44
workflow_call:
55

6-
name: phs_style_and_document.yaml
6+
name: phs_document.yaml
77

88
permissions:
99
contents: read
1010
pull-requests: read
1111

1212
jobs:
13-
style:
14-
name: "Automatically style the code using air"
15-
runs-on: ubuntu-latest
16-
permissions:
17-
contents: write
18-
pull-requests: write
19-
env:
20-
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
21-
steps:
22-
- name: Checkout repo
23-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
24-
with:
25-
fetch-depth: 0
26-
ref: ${{ github.event.pull_request.head.sha }}
27-
28-
- name: Install posit-dev/air
29-
uses: posit-dev/setup-air@63e80dedb6d275c94a3841e15e5ff8691e1ab237 # v1.0.0
30-
31-
- name: Format
32-
run: air format .
33-
34-
- name: Commit and push changes
35-
id: commit_step_style
36-
uses: stefanzweifel/git-auto-commit-action@b863ae1933cb653a53c021fe36dbb774e1fb9403 # v5.2.0
37-
with:
38-
commit_message: "Style code (GHA)"
39-
40-
- name: Create Pull Request
41-
if: steps.commit_step_style.outcome == 'failure'
42-
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
43-
with:
44-
commit-message: "Style code (GHA)"
45-
branch: auto-style-code
46-
delete-branch: true
47-
title: "Style code (GHA)"
48-
labels: maintenance
49-
assignees: ${{ github.actor }}
50-
reviewers: ${{ github.actor }}
51-
52-
document:
53-
name: "Automatically document the code using roxygen2"
54-
needs: style
13+
phs_document:
14+
name: "Automatically re-build the package documentation"
5515
runs-on: ubuntu-latest
5616
permissions:
5717
contents: write
@@ -104,4 +64,4 @@ jobs:
10464
title: "Document package (GHA)"
10565
labels: maintenance
10666
assignees: ${{ github.actor }}
107-
reviewers: ${{ github.actor }}
67+
reviewers: ${{ github.actor }}

.github/workflows/phs_package_checks.yaml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,18 @@ permissions:
1616
pull-requests: read
1717

1818
jobs:
19-
Style_and_document:
20-
uses: ./.github/workflows/phs_style_and_document.yaml
19+
Style:
20+
uses: ./.github/workflows/phs_style.yaml
21+
permissions:
22+
contents: write
23+
pull-requests: write
24+
secrets: inherit
25+
concurrency:
26+
group: ${{ github.workflow }}-${{ github.ref }}
27+
cancel-in-progress: true
28+
Document:
29+
needs: [Style]
30+
uses: ./.github/workflows/phs_document.yaml
2131
permissions:
2232
contents: write
2333
pull-requests: write
@@ -26,7 +36,7 @@ jobs:
2636
group: ${{ github.workflow }}-${{ github.ref }}
2737
cancel-in-progress: true
2838
R-CMD-check:
29-
needs: [Style_and_document]
39+
needs: [Document]
3040
uses: ./.github/workflows/phs_R-CMD-check.yaml
3141
permissions:
3242
contents: read
@@ -44,8 +54,8 @@ jobs:
4454
group: ${{ inputs.limit_parallel == false && format('test-coverage-{0}-{1}', github.workflow, github.run_id) || 'package-checks-queue' }}
4555
cancel-in-progress: false
4656
pkgdown:
47-
needs: [Style_and_document]
57+
needs: [Document]
4858
uses: ./.github/workflows/phs_pkgdown.yaml
4959
permissions:
5060
contents: write
51-
secrets: inherit
61+
secrets: inherit

.github/workflows/phs_style.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2+
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3+
on:
4+
workflow_call:
5+
6+
name: phs_style.yaml
7+
8+
permissions:
9+
contents: read
10+
pull-requests: read
11+
12+
jobs:
13+
phs_style:
14+
name: "Automatically style the code using air"
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: write
18+
pull-requests: write
19+
env:
20+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
21+
steps:
22+
- name: Checkout repo
23+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
24+
with:
25+
fetch-depth: 0
26+
ref: ${{ github.event.pull_request.head.sha }}
27+
28+
- name: Install posit-dev/air
29+
uses: posit-dev/setup-air@63e80dedb6d275c94a3841e15e5ff8691e1ab237 # v1.0.0
30+
31+
- name: Format
32+
run: air format .
33+
34+
- name: Commit and push changes
35+
id: commit_step_style
36+
uses: stefanzweifel/git-auto-commit-action@b863ae1933cb653a53c021fe36dbb774e1fb9403 # v5.2.0
37+
with:
38+
commit_message: "Style code (GHA)"
39+
40+
- name: Create Pull Request
41+
if: steps.commit_step_style.outcome == 'failure'
42+
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
43+
with:
44+
commit-message: "Style code (GHA)"
45+
branch: auto-style-code
46+
delete-branch: true
47+
title: "Style code (GHA)"
48+
labels: maintenance
49+
assignees: ${{ github.actor }}
50+
reviewers: ${{ github.actor }}
51+

0 commit comments

Comments
 (0)