Skip to content

Commit 163dc32

Browse files
authored
Merge pull request #532 from nextcloud/backport/530/stable21
2 parents 6393cca + c31580e commit 163dc32

File tree

10 files changed

+16953
-180
lines changed

10 files changed

+16953
-180
lines changed
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
name: Compile Command
2+
on:
3+
issue_comment:
4+
types: [created]
5+
6+
jobs:
7+
init:
8+
runs-on: ubuntu-latest
9+
10+
# On pull requests and if the comment starts with `/compile`
11+
if: github.event.issue.pull_request != '' && startsWith(github.event.comment.body, '/compile')
12+
13+
outputs:
14+
git_path: ${{ steps.git-path.outputs.path }}
15+
arg1: ${{ steps.command.outputs.arg1 }}
16+
arg2: ${{ steps.command.outputs.arg2 }}
17+
head_ref: ${{ steps.comment-branch.outputs.head_ref }}
18+
19+
steps:
20+
- name: Check actor permission
21+
uses: skjnldsv/check-actor-permission@v2
22+
with:
23+
require: write
24+
25+
- name: Add reaction on start
26+
uses: peter-evans/create-or-update-comment@v1
27+
with:
28+
token: ${{ secrets.COMMAND_BOT_PAT }}
29+
repository: ${{ github.event.repository.full_name }}
30+
comment-id: ${{ github.event.comment.id }}
31+
reaction-type: "+1"
32+
33+
- name: Parse command
34+
uses: skjnldsv/parse-command-comment@master
35+
id: command
36+
37+
# Init path depending on which command is run
38+
- name: Init path
39+
id: git-path
40+
run: |
41+
if ${{ startsWith(steps.command.outputs.arg1, '/') }}; then
42+
echo "::set-output name=path::${{ github.workspace }}${{steps.command.outputs.arg1}}"
43+
else
44+
echo "::set-output name=path::${{ github.workspace }}${{steps.command.outputs.arg2}}"
45+
fi
46+
47+
- name: Init branch
48+
uses: xt0rted/pull-request-comment-branch@v1
49+
id: comment-branch
50+
51+
process:
52+
runs-on: ubuntu-latest
53+
needs: init
54+
55+
steps:
56+
- name: Checkout ${{ needs.init.outputs.head_ref }}
57+
uses: actions/checkout@v2
58+
with:
59+
token: ${{ secrets.COMMAND_BOT_PAT }}
60+
fetch-depth: 0
61+
ref: ${{ needs.init.outputs.head_ref }}
62+
63+
- name: Setup git
64+
run: |
65+
git config --local user.email "nextcloud-command@users.noreply.github.com"
66+
git config --local user.name "nextcloud-command"
67+
68+
- name: Read package.json node and npm engines version
69+
uses: skjnldsv/read-package-engines-version-actions@v1
70+
id: package-engines-versions
71+
with:
72+
fallbackNode: '^12'
73+
fallbackNpm: '^6'
74+
75+
- name: Set up node ${{ steps.package-engines-versions.outputs.nodeVersion }}
76+
uses: actions/setup-node@v2
77+
with:
78+
node-version: ${{ steps.package-engines-versions.outputs.nodeVersion }}
79+
cache: npm
80+
81+
- name: Set up npm ${{ steps.package-engines-versions.outputs.npmVersion }}
82+
run: npm i -g npm@"${{ steps.package-engines-versions.outputs.npmVersion }}"
83+
84+
- name: Install dependencies & build
85+
run: |
86+
npm ci
87+
npm run build --if-present
88+
89+
- name: Commit and push default
90+
if: ${{ needs.init.outputs.arg1 != 'fixup' && needs.init.outputs.arg1 != 'amend' }}
91+
run: |
92+
git add ${{ needs.init.outputs.git_path }}
93+
git commit --signoff -m 'Compile assets'
94+
git push origin ${{ needs.init.outputs.head_ref }}
95+
96+
- name: Commit and push fixup
97+
if: ${{ needs.init.outputs.arg1 == 'fixup' }}
98+
run: |
99+
git add ${{ needs.init.outputs.git_path }}
100+
git commit --fixup=HEAD --signoff
101+
git push origin ${{ needs.init.outputs.head_ref }}
102+
103+
- name: Commit and push amend
104+
if: ${{ needs.init.outputs.arg1 == 'amend' }}
105+
run: |
106+
git add ${{ needs.init.outputs.git_path }}
107+
git commit --amend --no-edit --signoff
108+
git push --force origin ${{ needs.init.outputs.head_ref }}
109+
110+
- name: Add reaction on failure
111+
uses: peter-evans/create-or-update-comment@v1
112+
if: failure()
113+
with:
114+
token: ${{ secrets.COMMAND_BOT_PAT }}
115+
repository: ${{ github.event.repository.full_name }}
116+
comment-id: ${{ github.event.comment.id }}
117+
reaction-type: "-1"
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# This workflow is provided via the organization template repository
2+
#
3+
# https://github.com/nextcloud/.github
4+
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5+
6+
name: Rebase command
7+
8+
on:
9+
issue_comment:
10+
types: created
11+
12+
jobs:
13+
rebase:
14+
runs-on: ubuntu-latest
15+
16+
# On pull requests and if the comment starts with `/rebase`
17+
if: github.event.issue.pull_request != '' && startsWith(github.event.comment.body, '/rebase')
18+
19+
steps:
20+
- name: Add reaction on start
21+
uses: peter-evans/create-or-update-comment@v1
22+
with:
23+
token: ${{ secrets.COMMAND_BOT_PAT }}
24+
repository: ${{ github.event.repository.full_name }}
25+
comment-id: ${{ github.event.comment.id }}
26+
reaction-type: "+1"
27+
28+
- name: Checkout the latest code
29+
uses: actions/checkout@v2
30+
with:
31+
fetch-depth: 0
32+
token: ${{ secrets.COMMAND_BOT_PAT }}
33+
34+
- name: Automatic Rebase
35+
uses: cirrus-actions/rebase@1.5
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.COMMAND_BOT_PAT }}
38+
39+
- name: Add reaction on failure
40+
uses: peter-evans/create-or-update-comment@v1
41+
if: failure()
42+
with:
43+
token: ${{ secrets.COMMAND_BOT_PAT }}
44+
repository: ${{ github.event.repository.full_name }}
45+
comment-id: ${{ github.event.comment.id }}
46+
reaction-type: "-1"

.github/workflows/lint-eslint.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# This workflow is provided via the organization template repository
2+
#
3+
# https://github.com/nextcloud/.github
4+
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5+
6+
name: Lint
7+
8+
on:
9+
pull_request:
10+
push:
11+
branches:
12+
- master
13+
- stable*
14+
15+
jobs:
16+
lint:
17+
runs-on: ubuntu-latest
18+
19+
name: eslint
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v2
24+
25+
- name: Read package.json node and npm engines version
26+
uses: skjnldsv/read-package-engines-version-actions@v1.1
27+
id: versions
28+
with:
29+
fallbackNode: '^12'
30+
fallbackNpm: '^6'
31+
32+
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
33+
uses: actions/setup-node@v2
34+
with:
35+
node-version: ${{ steps.versions.outputs.nodeVersion }}
36+
37+
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
38+
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
39+
40+
- name: Install dependencies
41+
run: npm ci
42+
43+
- name: Lint
44+
run: npm run lint

.github/workflows/lint-php-cs.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# This workflow is provided via the organization template repository
2+
#
3+
# https://github.com/nextcloud/.github
4+
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5+
6+
name: Lint
7+
8+
on:
9+
pull_request:
10+
push:
11+
branches:
12+
- master
13+
- stable*
14+
15+
jobs:
16+
lint:
17+
runs-on: ubuntu-latest
18+
19+
name: php-cs
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v2
24+
25+
- name: Set up php ${{ matrix.php-versions }}
26+
uses: shivammathur/setup-php@v2
27+
with:
28+
php-version: "7.4"
29+
coverage: none
30+
31+
- name: Install dependencies
32+
run: composer i
33+
34+
- name: Lint
35+
run: composer run cs:check || ( echo 'Please run `composer run cs:fix` to format your code' && exit 1 )

.github/workflows/lint-php.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# This workflow is provided via the organization template repository
2+
#
3+
# https://github.com/nextcloud/.github
4+
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5+
6+
name: Lint
7+
8+
on:
9+
pull_request:
10+
push:
11+
branches:
12+
- master
13+
- stable*
14+
15+
jobs:
16+
lint:
17+
runs-on: ubuntu-latest
18+
strategy:
19+
matrix:
20+
php-versions: ["7.3", "7.4", "8.0"]
21+
22+
name: php
23+
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v2
27+
28+
- name: Set up php ${{ matrix.php-versions }}
29+
uses: shivammathur/setup-php@v2
30+
with:
31+
php-version: ${{ matrix.php-versions }}
32+
coverage: none
33+
34+
- name: Lint
35+
run: composer run lint
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# This workflow is provided via the organization template repository
2+
#
3+
# https://github.com/nextcloud/.github
4+
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5+
6+
name: Lint
7+
8+
on:
9+
pull_request:
10+
push:
11+
branches:
12+
- master
13+
- stable*
14+
15+
jobs:
16+
lint:
17+
runs-on: ubuntu-latest
18+
19+
name: stylelint
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v2
24+
25+
- name: Read package.json node and npm engines version
26+
uses: skjnldsv/read-package-engines-version-actions@v1.1
27+
id: versions
28+
with:
29+
fallbackNode: '^12'
30+
fallbackNpm: '^6'
31+
32+
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
33+
uses: actions/setup-node@v2
34+
with:
35+
node-version: ${{ steps.versions.outputs.nodeVersion }}
36+
37+
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
38+
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
39+
40+
- name: Install dependencies
41+
run: npm ci
42+
43+
- name: Lint
44+
run: npm run stylelint

0 commit comments

Comments
 (0)