Skip to content

feat(ci): add /explain-ci bot command for PR failure help#60821

Draft
miaulalala wants to merge 3 commits into
masterfrom
feat/noid/explain-ci-bot
Draft

feat(ci): add /explain-ci bot command for PR failure help#60821
miaulalala wants to merge 3 commits into
masterfrom
feat/noid/explain-ci-bot

Conversation

@miaulalala
Copy link
Copy Markdown
Contributor

@miaulalala miaulalala commented May 28, 2026

Summary

  • Adds .github/workflows/ci-bot.yml: a new slash-command bot triggered by commenting /explain-ci on any pull request
  • When invoked, nextcloud-bot reacts to the comment with 👍 and posts a single summary of all currently-failing CI checks, explaining what each one validates and how to fix it locally
  • Covers all ~40 developer-facing PR workflows with specific fix instructions
  • Extends autotest.sh with Docker-backed service helpers for local reproduction of external-service CI failures

How the bot works

The bot uses the issue_comment trigger (same pattern as /compile and /update-3rdparty), so it has access to COMMAND_BOT_PAT and works on fork PRs too. It:

  1. Fetches all completed workflow runs for the PR's current commit SHA via the Actions API
  2. Deduplicates by workflow name (takes the most recent run per workflow)
  3. Looks up each failing workflow in a static explanation map
  4. Posts a formatted summary — or a "no failures found" message if everything is green

Workflows covered

All PHPUnit variants (SQLite, MariaDB, MySQL, PostgreSQL, OCI, nodb, 32bits, memcached, sharding, primary object store, all files_external backends), ESLint, Stylelint, PHP lint, PHP-CS-Fixer, Psalm, Cypress, Node build/tests, REUSE, OpenAPI, Rector, Behat integration tests (DAV, Litmus, SQLite), object storage tests (S3, Azure, Swift), Samba Kerberos SSO, Code checkers, block checks (fixup commits, unconventional commits, outdated 3rdparty/), and CodeQL.

New autotest.sh Docker service helpers

autotest.sh now supports spinning up Docker-backed external services automatically, making it possible to reproduce CI failures locally without any manual container setup:

Variable What it does
EXTERNAL_STORAGE=ftp Starts vsftpd, runs files_external FTP tests
EXTERNAL_STORAGE=sftp Starts atmoz/sftp, runs files_external SFTP tests
EXTERNAL_STORAGE=smb Starts Samba, runs files_external SMB tests
EXTERNAL_STORAGE=webdav Starts Apache WebDAV, runs files_external WebDAV tests
EXTERNAL_STORAGE=amazons3 Starts LocalStack, runs files_external S3 tests
PRIMARY_STORAGE_CONFIG=s3 USEDOCKER=1 Starts MinIO as primary object store
PRIMARY_STORAGE_CONFIG=azure USEDOCKER=1 Starts Azurite as primary object store
ENABLE_MEMCACHE=memcached USEDOCKER=1 Starts Memcached, copies tests/memcached.config.php

Each helper installs Nextcloud, enables the relevant app/config, waits for the service to be healthy, runs the tests, and tears down the container — no manual cleanup needed. Pre-flight checks catch missing system dependencies (e.g. php-smbclient, smbclient binary) before wasting time on an install.

Example usage

Comment /explain-ci on a PR with failing checks → nextcloud-bot replies:

CI failure summary

Found 2 failing check(s) on commit abc1234:


Lint eslint

What this checks: Checks JavaScript/TypeScript/Vue source files for ESLint rule violations.

How to fix locally:

  • Run npm run lint to see all violations.
  • Run npm run lint:fix to auto-fix many of them, then review remaining errors manually.

View failed run

Test plan

  • Comment /explain-ci on a PR with at least one failing check → bot reacts with 👍 and posts summary
  • Comment /explain-ci on a PR where all checks pass → bot replies "no failing checks found"
  • Comment /explain-ci on a fork PR → bot works (issue_comment runs in base repo context)
  • Re-run a failed check, then comment /explain-ci → only still-failing checks appear in summary
  • EXTERNAL_STORAGE=ftp NOCOVERAGE=1 ./autotest.sh → all FTP tests pass
  • EXTERNAL_STORAGE=amazons3 NOCOVERAGE=1 ./autotest.sh → all S3 tests pass
  • PRIMARY_STORAGE_CONFIG=s3 USEDOCKER=1 NOCOVERAGE=1 ./autotest.sh sqlite lib/Files/ObjectStore/S3Test.php → MinIO tests pass

🤖 Generated with Claude Code

@miaulalala miaulalala requested a review from a team as a code owner May 28, 2026 20:42
@miaulalala miaulalala requested review from ArtificialOwl, icewind1991, leftybournes and salmart-dev and removed request for a team May 28, 2026 20:42
Adds a new GitHub Actions workflow that responds to `/explain-ci`
comments on pull requests. When triggered, nextcloud-bot posts a
summary of all currently-failing CI checks with a plain-language
description of what each check validates and step-by-step local fix
instructions.

Covers all 40 developer-facing PR workflows: PHPUnit (all DB
backends), linting (ESLint, Stylelint, PHP, PHP-CS-Fixer), Psalm,
Cypress, Node build/tests, REUSE, OpenAPI, Rector, Behat integration
tests, external storage tests, object storage tests, block checks
(fixup commits, conventional commits, outdated 3rdparty), Code
checkers, and CodeQL.

Uses the same slash-command pattern as /compile and /update-3rdparty:
issue_comment trigger (works on fork PRs), COMMAND_BOT_PAT for bot
identity, and peter-evans/create-or-update-comment for the +1
reaction acknowledgement.

AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Anna Larch <anna@nextcloud.com>
@miaulalala miaulalala marked this pull request as draft May 28, 2026 21:18
@miaulalala miaulalala force-pushed the feat/noid/explain-ci-bot branch from 2a82f09 to a893f1f Compare May 28, 2026 21:18
Adds two improvements to the developer testing experience:

1. /explain-ci bot (.github/workflows/ci-bot.yml)
   - Triggered by commenting /explain-ci on any PR
   - nextcloud-bot replies with a summary of all currently-failing
     checks: what each one validates and how to fix it locally
   - Separates known-flaky checks (Cypress, MySQL race, external
     services) from checks that need investigation
   - Covers all 40 PR-facing workflows with specific fix commands,
     Docker run instructions, and composer script references

2. Docker service support in autotest.sh
   - PRIMARY_STORAGE_CONFIG=s3: spins up minio/minio for S3 primary
     object store tests (preseed-config.php already handles the config
     via OBJECT_STORE env vars)
   - PRIMARY_STORAGE_CONFIG=azure: spins up Azurite for Azure primary
     object store tests
   - ENABLE_MEMCACHE=memcached with USEDOCKER=1: spins up Memcached
     on port 11212; adds tests/memcached.config.php
   - EXTERNAL_STORAGE=ftp|sftp|smb|webdav|amazons3: full self-contained
     flow — installs Nextcloud with SQLite, enables files_external,
     spins up the appropriate Docker service, writes the config.X.php,
     runs the storage test suite, cleans up
   - Pre-flight checks for missing system dependencies (php-memcached,
     smbclient) with clear install instructions before any work is done
   - print_syntax updated with all new environment variables

AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Anna Larch <anna@nextcloud.com>
AI-Assisted-By: claude-sonnet-4-6 <noreply@anthropic.com>
Signed-off-by: Anna Larch <anna@nextcloud.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant