Merge pull request #619 from Appsilon/release-1.10.1 #117
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow initializes a fresh Rhino app and pushes it to a dedicated orphan branch. | |
# This way we can test the app CI (the GitHub Actions workflow created on `rhino::init()`). | |
name: App Push Test | |
on: | |
push: | |
branches: [main] | |
workflow_dispatch: | |
permissions: {} | |
jobs: | |
main: | |
name: Push fresh app | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
env: | |
BRANCH_NAME: bot/app-push-test | |
steps: | |
- name: Install R | |
uses: r-lib/actions/setup-r@v2 | |
with: | |
use-public-rspm: true | |
- name: Install Rhino | |
uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
packages: Appsilon/rhino@${{ github.sha }} | |
# The previous step installs `renv` using `pak`, | |
# but it subsequentially fails in the pushed app and breaks the test | |
# (see https://github.com/rstudio/renv/issues/1772). | |
# This step is is a workaround and can be removed once the issue is resolved. | |
- name: Install renv | |
shell: Rscript {0} | |
run: install.packages("renv") | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
# The default GITHUB_PAT has insufficient permissions to push workflow changes. | |
# The token passed here must have write access to code and workflows. | |
token: ${{ secrets.APP_PUSH_TEST_PAT }} | |
- name: Prepare branch | |
run: git switch --orphan "$BRANCH_NAME" | |
- name: Initialize app | |
shell: Rscript {0} | |
run: rhino::init() | |
- name: Push branch | |
run: | | |
SHORT_SHA=$(printf %.8s "$GITHUB_SHA") | |
git config user.name "$GITHUB_ACTOR" | |
git config user.email "[email protected]" | |
git add . | |
git commit --message "App Push Test (${GITHUB_REF_NAME}@${SHORT_SHA})" | |
git push --force origin "$BRANCH_NAME" |