Skip to content

Commit 2ff762d

Browse files
committed
ci(rector): Automatically send rector PRs
Signed-off-by: Joas Schilling <coding@schilljs.com>
1 parent 211ccad commit 2ff762d

3 files changed

Lines changed: 79 additions & 1 deletion

File tree

.github/workflows/rector-apply.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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+
# SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
7+
# SPDX-License-Identifier: MIT
8+
9+
name: Apply rector changes
10+
11+
on:
12+
workflow_dispatch:
13+
schedule:
14+
# At 14:30 on Sundays
15+
- cron: '30 14 * * 0'
16+
17+
permissions:
18+
contents: read
19+
20+
jobs:
21+
build:
22+
runs-on: ubuntu-latest
23+
24+
name: rector-apply
25+
26+
steps:
27+
- name: Checkout
28+
id: checkout
29+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
30+
with:
31+
persist-credentials: false
32+
ref: ${{ github.event.repository.default_branch }}
33+
34+
- name: Get php version
35+
id: versions
36+
uses: icewind1991/nextcloud-version-matrix@8a7bac6300b2f0f3100088b297995a229558ddba # v1.3.2
37+
38+
- name: Set up php${{ steps.versions.outputs.php-min }}
39+
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2
40+
with:
41+
php-version: ${{ steps.versions.outputs.php-min }}
42+
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite
43+
coverage: none
44+
ini-file: development
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
48+
- name: Remove nextcloud/ocp
49+
run: |
50+
composer remove nextcloud/ocp --dev --no-scripts
51+
52+
- name: Install composer dependencies
53+
uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0
54+
55+
- name: Rector
56+
run: composer run rector
57+
58+
- name: Create Pull Request
59+
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
60+
with:
61+
token: ${{ secrets.COMMAND_BOT_PAT }}
62+
commit-message: 'refactor: Apply rector changes'
63+
committer: GitHub <noreply@github.com>
64+
author: nextcloud-command <nextcloud-command@users.noreply.github.com>
65+
signoff: true
66+
branch: automated/noid/rector-changes
67+
title: 'Apply rector changes'
68+
labels: |
69+
technical debt
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
diff --git a/.github/workflows/rector-apply.yml b/.github/workflows/rector-apply.yml
2+
index c61c5b1062..c98cbe3721 100644
3+
--- a/.github/workflows/rector-apply.yml
4+
+++ b/.github/workflows/rector-apply.yml
5+
@@ -67,4 +67,3 @@ jobs:
6+
title: 'Apply rector changes'
7+
labels: |
8+
technical debt
9+
- 3. to review

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"lint": "find . -type f -name '*.php' -not -path './vendor/*' -not -path './vendor-bin/*' -not -path './lib/Vendor/*' -not -path './build/*' -not -path './tests/integration/vendor/*' -not -path 'tests/stubs/*' -print0 | xargs -0 -n200 -P$(nproc) php -l",
2323
"openapi": "generate-spec && (npm run ts:generate || echo 'Please manually regenerate the typescript OpenAPI models')",
2424
"rector:check": "rector --dry-run",
25-
"rector:fix": "rector && php-cs-fixer fix",
25+
"rector": "rector && php-cs-fixer fix",
2626
"psalm": "psalm --no-cache --threads=$(nproc)",
2727
"psalm:dev": "@psalm",
2828
"psalm:update-baseline": "psalm --threads=1 --update-baseline --set-baseline=tests/psalm-baseline.xml",

0 commit comments

Comments
 (0)