-
Notifications
You must be signed in to change notification settings - Fork 2
103 lines (82 loc) · 2.79 KB
/
build_book.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: Build Book with Babel Quarto
on:
pull_request:
branches:
- crowdin_integration
push:
branches:
- crowdin_integration
workflow_dispatch:
env:
NEW_BRANCH: build_book-
jobs:
merge_and_build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: true
- name: Set New Branch Name
id: set_branch
run: echo "NEW_BRANCH=${NEW_BRANCH}$(date +'%Y-%m-%d-%H-%M-%S')" >> $GITHUB_ENV
- name: Setup R
run: |
sudo apt-get update
sudo apt-get install r-base
sudo apt-get install r-base-core
- name: Create writable directory
run: mkdir my_R_library
- name: Update permissions
run: chmod u+w ./my_R_library
- name: Install Babelquarto
run: Rscript -e "install.packages('babelquarto', repos = c('https://ropensci.r-universe.dev', 'https://cloud.r-project.org'), lib = './my_R_library')"
- name: Build book
run: |
Rscript ./JSquarto/scripts/build_book.R
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 16.x
- name: Install dependencies
run: npm install
- name: Fix built book
run: npm run fix:all languages=en,ar
- name: Commit changes
run: |
git config --global user.email "[email protected]"
git config --global user.name "Richie"
git checkout -b $NEW_BRANCH
git status
git add .
git commit -m "Build book with babelquarto"
git push origin $NEW_BRANCH
- name: Create Pull Request
id: create_pr
uses: repo-sync/pull-request@v2
with:
source_branch: ${{ env.NEW_BRANCH }}
destination_branch: build_crowdin_integration
pr_title: New book build with babelquarto
pr_body: |
:crown: *An automated PR*
Automated PR build book with babel-quarto
_Created by [repo-sync/pull-request](https://github.com/repo-sync/pull-request)_
pr_reviewer: "@RealRichi3"
pr_assignee: "RealRichi3"
pr_label: "auto-pr"
pr_draft: false
pr_allow_empty: true
token: ${{ secrets.PAT_TOKEN }}
- name: Pull request number
run: echo "Pull Request Number - ${{ steps.create_pr.outputs.pull_request_number }}"
id: pr_number
# - name: Approve pull Request
# if: steps.create_pr.outputs.pull_request_number
# uses: hmarr/auto-approve-action@v2
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# pull-request-number: ${{ steps.create_pr.outputs.pull_request_number }}