-
Notifications
You must be signed in to change notification settings - Fork 25
56 lines (50 loc) · 1.82 KB
/
app-push-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# 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"