App Push Test #62
Workflow file for this run
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 }} | |
# While renv is already installed in the previous step, | |
# it subsequentially fails in the pushed app (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 %s "$GITHUB_SHA" | cut -c-8) | |
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" |