{"record":{"id":"0da1be14d649ad27","repo":"theonedev/onedev","slug":"build-required-for-this-change-please-submit-pull","errorCode":null,"errorMessage":"Build required for this change. Please submit pull request instead","messagePattern":"Build required for this change\\. Please submit pull request instead","errorType":"exception","errorClass":"BlobEditException","httpStatus":null,"severity":"warning","filePath":"server-core/src/main/java/io/onedev/server/web/page/project/blob/ProjectBlobPage.java","lineNumber":1635,"sourceCode":"\t\tUser user = Preconditions.checkNotNull(SecurityUtils.getAuthUser());\n\t\tBlobIdent blobIdent = getBlobIdent();\n\t\t\n\t\tboolean signRequired = false;\n\t\tfor (var item: upload.getItems()) {\n\t\t\tString blobPath = FilenameUtils.sanitizeFileName(FileUpload.getFileName(item));\n\t\t\tif (parentPath != null)\n\t\t\t\tblobPath = parentPath + \"/\" + blobPath;\n\t\t\tvar blobType = FileExtension.getExtension(blobPath);\n\n\t\t\tvar disallowedFileTypes = getProject().getBranchProtection(blobIdent.revision, user).getDisallowedFileTypes();\n\t\t\tif (disallowedFileTypes.stream().anyMatch(type -> type.equalsIgnoreCase(blobType))) {\n\t\t\t\tthrow new BlobEditException(MessageFormat.format(_T(\"Not allowed file type: {0}\"), blobType));\n\t\t\t}\n\n\t\t\tif (getProject().isReviewRequiredForModification(user, blobIdent.revision, blobPath)) \n\t\t\t\tthrow new BlobEditException(_T(\"Review required for this change. Please submit pull request instead\"));\n\t\t\telse if (getProject().isBuildRequiredForModification(user, blobIdent.revision, blobPath)) \n\t\t\t\tthrow new BlobEditException(_T(\"Build required for this change. Please submit pull request instead\"));\n\t\t\telse if (getProject().isCommitSignatureRequiredButNoSigningKey(user, blobIdent.revision)) \n\t\t\t\tsignRequired = true;\n\t\t\t\n\t\t\tBlobContent blobContent = new BlobContent(item.get(), FileMode.REGULAR_FILE.getBits());\n\t\t\tnewBlobs.put(blobPath, blobContent);\n\t\t}\n\n\t\tBlobEdits blobEdits = new BlobEdits(Sets.newHashSet(), newBlobs);\n\t\tString refName = blobIdent.revision!=null? GitUtils.branch2ref(blobIdent.revision):\"refs/heads/main\";\n\n\t\tObjectId prevCommitId;\n\t\tif (blobIdent.revision != null)\n\t\t\tprevCommitId = getProject().getRevCommit(blobIdent.revision, true).copy();\n\t\telse\n\t\t\tprevCommitId = ObjectId.zeroId();\n\n\t\twhile (true) {\n\t\t\ttry {","sourceCodeStart":1617,"sourceCodeEnd":1653,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/web/page/project/blob/ProjectBlobPage.java#L1617-L1653","documentation":"When saving a blob edit, ProjectBlobPage calls Project.isBuildRequiredForModification; if branch protection requires a successful build before modifying the path, a BlobEditException tells the user to submit a pull request so CI can validate the change.","triggerScenarios":"Direct web-editor commit to a branch whose protection has a build requirement (successful CI build needed) for the changed path or revision.","commonSituations":"Editing files on main where 'build required for modification' is enabled; the last commit on the branch has no successful build.","solutions":["Submit a pull request from a feature branch so the required build runs on it","Ensure the target branch's latest commit has a successful build if direct commits are otherwise allowed","Relax the build-required rule in branch protection if inappropriate"],"exampleFix":"// before: web-edit file directly on protected main with build requirement\n// after: branch feature/x -> edit -> push -> CI runs -> open PR","handlingStrategy":"validation","validationCode":"if (project.isBuildRequiredForModification(user, revision, path)) {\n    // require PR flow so CI validates the change\n}","typeGuard":null,"tryCatchPattern":"try {\n    saveBlob();\n} catch (BlobEditException e) {\n    offerPullRequestWorkflow();\n}","preventionTips":["Ensure branch has a green build before direct edits if build-required is on","Prefer PRs on branches with build requirements","Review branch protection CI rules before editing"],"tags":["branch-protection","ci","pull-request","build-required"],"backgroundTag":"permission-denied","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}