From fa76c97682db6fffbaa8ce11ebf030011512bb05 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 8 Jul 2026 09:01:49 +0200 Subject: [PATCH 1/2] docs(workflows): Document workflow sync and patching Signed-off-by: Joas Schilling --- README.md | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index dd5bced4..8b5c8c38 100644 --- a/README.md +++ b/README.md @@ -12,18 +12,29 @@ https://github.com/nextcloud/viewer/actions/new ![image](https://raw.githubusercontent.com/nextcloud/.github/master/screenshots/choose-a-workflow.png) -## Auto-update repositories +## Auto-update in a repository -For each template, you can propagate them on all the repos that use it. -1. Go into https://github.com/nextcloud/.github/actions/workflows/dispatch-workflow.yml -2. Enter the name of the workflow you want to dispatch -3. Enter the page you want to execute (100 are done per page, so check the [number of repositories](https://github.com/orgs/nextcloud/repositories), current is 260 so run for page: 1, 2 and 3) +There is a GitHub action for that as well. Simply install +https://github.com/nextcloud/.github/blob/master/workflow-templates/sync-workflow-templates.yml +into your repository and a cron job will update the workflows from the template every sunday morning. - ![image](https://raw.githubusercontent.com/nextcloud/.github/master/screenshots/dispatch-a-workflow.png) +> ![NOTE] +> GitHub does not allow pull request that touch workflows to be auto-approved and auto-merged to improve security. +> But it's at least much easier to be aware of the updates and you just need to approve and merge the PRs. -4. Wait for the actions to finish and see the checkout the pull requests +## Patching workflows -## Update workflows with a script +It's also possible to customise workflows by putting a `workflow.yml.patch` file right next to it. +The patch files should be one per workflow and made from the repository root: + +Example: +1. Modify `.github/workflows/phpunit-mariadb.yml` +2. Save patch `git diff .github/workflows/phpunit-mariadb.yml > .github/workflows/phpunit-mariadb.yml.patch` + +The `sync-workflow-templates.yml` action also supports this and reapplies the patches if possible. +If there was an error it will be outlined in the PR description. + +## Update workflows manually You can also run the following shell script on your machine to update all workflows of an app. It should be run inside the cloned repository of an app and requires rsync to be installed. @@ -51,6 +62,15 @@ rsync -vr \ "$temp/workflow-templates/" \ ./.github/workflows/ +# Reapply patches +for patch in ./.github/workflows/*.yml.patch; do + [ ! -f "$patch" ] && continue + echo "🩹 Applying $patch" + if ! patch -p1 < "$patch"; then + echo "❌ Failed to apply $patch, please resolve manually" + fi +done + # Cleanup rm -rf "$temp" ``` From b8c941690541c314703c8969b7193be69935f2eb Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 8 Jul 2026 09:12:00 +0200 Subject: [PATCH 2/2] docs: Fix note block Signed-off-by: Joas Schilling --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8b5c8c38..c0f8be68 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ There is a GitHub action for that as well. Simply install https://github.com/nextcloud/.github/blob/master/workflow-templates/sync-workflow-templates.yml into your repository and a cron job will update the workflows from the template every sunday morning. -> ![NOTE] +> [!NOTE] > GitHub does not allow pull request that touch workflows to be auto-approved and auto-merged to improve security. > But it's at least much easier to be aware of the updates and you just need to approve and merge the PRs.