Draft pull request plugin
The Bitbucket draft pull request plugin allows you to label a pull request as a draft. While a pull request is marked as a draft, the merge button is not available.
![Bitbucket pull request marked as draft using label and failing merge check](/_astro/draft-failing.e89eef7d_2dOxXS.webp)
This is useful to signal that it is still a work in progress (WIP) - even if all other checks are passing, it is not ready to be merged yet.
This plugin supports the draft pull request workflow by:
- Using a label to identify draft pull requests
- Creating an extended check to prevent merging of draft pull requests
- Optionally add the draft label to new pull requests automatically
The simplest configuration is:
ts
import {configure } from "flowie.app"import {draftPullRequest ,merge } from "flowie.app/plugins"configure ({plugins : [// Use merge plugin to enforce merge checksmerge (),draftPullRequest (),],})
Using the options:
ts
draftPullRequest ({draftOnCreate : false,label : {name : "WIP"},title : "**No** draft",})
![Bitbucket pull request marked as draft/WIP using custom options and failing merge check](/_astro/draft-pull-request-wip-custom-title.ad83fec6_1qeT5w.webp)
Options:
draftOnCreate
- if true, it adds the label automatically to the pull request, marking it as a draft. Default: true
label
- the label to use to mark the pull request as draft. If you specify a
label, it must be defined in the label schema as well.
Default: {name: "Draft"}
and is created automatically if not present in the schema.
title
- the title of the check. It supports markdown for formatting. Default: **No** work in progress
Draft as part of workflow
If you are using LabelSets to model workflow you can use them together by setting draft pull request as one of the possible values:
ts
import {configure } from "flowie.app"import {draftPullRequest } from "flowie.app/plugins"configure ({labels : {schema : [{name : "Status",values : [["Draft", {color : "Yellow300"}],"Ready to review",["Ready to merge", {color : "greenLight"}],],},],},plugins : [draftPullRequest ({label : {name : "Status",value : "Draft"},}),],})
Results in:
![Bitbucket pull request marked as draft using label and failing merge check](/_astro/draft-pull-request-workflow.1da2a59d_ZhsuBa.webp)
![Bitbucket pull request marked as draft using label and failing merge check](/_astro/draft-pull-request-status-draft.fcd6c9c9_28R6FS.webp)
![Bitbucket pull request marked as draft using label and failing merge check](/_astro/draft-pull-request-status-ready.7dc6b63d_Z1YU5d5.webp)