diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7cb74392..87a01282 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,16 +2,23 @@ name: ci on: workflow_dispatch: #get a button to trigger it by hand - push: + workflow_run: + workflows: + - Lint + type: + - completed jobs: build: runs-on: ubuntu-20.04 + if: ${{ github.event.workflow_run.conclusion == 'success' }} env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} R_KEEP_PKG_SOURCE: yes steps: - uses: actions/checkout@v3 + with: + ref: ${{ github.event.workflow_run.head_branch }} - uses: r-lib/actions/setup-r@v2 with: diff --git a/.github/workflows/document.yaml b/.github/workflows/document.yaml new file mode 100644 index 00000000..38ac401f --- /dev/null +++ b/.github/workflows/document.yaml @@ -0,0 +1,47 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +on: + workflow_run: + workflows: + - Style + type: + - completed + +name: Document + +jobs: + document: + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' }} + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + steps: + - name: Checkout repo + uses: actions/checkout@v3 + with: + fetch-depth: 0 + ref: ${{ github.event.workflow_run.head_branch }} + + - name: Setup R + uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + + - name: Install dependencies + uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::roxygen2 + needs: roxygen2 + + - name: Document + run: roxygen2::roxygenise() + shell: Rscript {0} + + - name: Commit and push changes + run: | + git config --local user.name "$GITHUB_ACTOR" + git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" + git add man/\* NAMESPACE DESCRIPTION + git commit -m "Update documentation" || echo "No changes to commit" + git pull --ff-only + git push origin diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index ceceed68..41a56aaa 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -1,20 +1,24 @@ # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help on: - push: - branches: [main, master, dev] - pull_request: - branches: [main, master, dev] + workflow_run: + workflows: + - Document + type: + - completed -name: lint +name: Lint jobs: lint: runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' }} env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: - uses: actions/checkout@v3 + with: + ref: ${{ github.event.workflow_run.head_branch }} - uses: r-lib/actions/setup-r@v2 with: diff --git a/.github/workflows/style_and_doc.yaml b/.github/workflows/style.yaml similarity index 63% rename from .github/workflows/style_and_doc.yaml rename to .github/workflows/style.yaml index d7e47b3c..b7cbc298 100644 --- a/.github/workflows/style_and_doc.yaml +++ b/.github/workflows/style.yaml @@ -2,7 +2,7 @@ # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help on: push: - paths: ["**.[rR]", "**.[qrR]md", "**.[rR]markdown", "**.[rR]nw", "**.[rR]profile"] + # paths: ["**.[rR]", "**.[qrR]md", "**.[rR]markdown", "**.[rR]nw", "**.[rR]profile"] name: Style @@ -65,44 +65,9 @@ jobs: then git config --local user.name "$GITHUB_ACTOR" git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" - git commit ${FILES_TO_COMMIT[*]} -m "style: styler (GHA)" + git commit ${FILES_TO_COMMIT[*]} -m "Style code (GHA)" git pull --ff-only git push origin else echo "No changes to commit." fi - - document: - needs: style - runs-on: ubuntu-latest - env: - GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - steps: - - name: Checkout repo - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Setup R - uses: r-lib/actions/setup-r@v2 - with: - use-public-rspm: true - - - name: Install dependencies - uses: r-lib/actions/setup-r-dependencies@v2 - with: - extra-packages: any::roxygen2 - needs: roxygen2 - - - name: Document - run: roxygen2::roxygenise() - shell: Rscript {0} - - - name: Commit and push changes - run: | - git config --local user.name "$GITHUB_ACTOR" - git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" - git add man/\* NAMESPACE DESCRIPTION - git commit -m "docs: update documentation (GHA)" || echo "No changes to commit" - git pull --ff-only - git push origin