Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure dependabot to create draft PRs #1291

Open
danail-branekov opened this issue Aug 1, 2019 · 15 comments · May be fixed by #9169
Open

Configure dependabot to create draft PRs #1291

danail-branekov opened this issue Aug 1, 2019 · 15 comments · May be fixed by #9169
Labels
F: configuration-file F: pull-requests Issues about Dependabot pull requests Keep Exempt this from being marked by stalebot T: feature-request Requests for new features

Comments

@danail-branekov
Copy link

danail-branekov commented Aug 1, 2019

Hello,

Is it possible to configure dependabot to create draft PRs instead of regular ones?

We could use this configuration as a workaround of dependabot not supporting golang vendoring (link1, link2(https://dependabot.com/blog/go-support/)). If dependabot could create a draft PR, we could revendor dependencies ourselves, run all tests and commit if everything is fine. For context, our project (Cloudfoundry Garden) is required to be buildable offline and therefore we need updated dependencies revendored in order to ship new releases.

Moderator note: Go vendoring is now supported by Dependabot. Leaving issue open because the feature request is valid for other scenarios.

@greysteil
Copy link
Contributor

Good question! It's not possible at the moment, but wouldn't be too tricky to add in future. Right now we're focussed on integrating into GitHub, but once that's finished (likely ~6 months I'm afraid) I'll pick this up. I also hope we'll have support for vendoring around then!

@stale stale bot added the wontfix label Oct 23, 2019
@feelepxyz feelepxyz added T: feature-request Requests for new features and removed wontfix labels Oct 23, 2019
@Aubron
Copy link

Aubron commented Mar 5, 2020

Similar reasoning - internally we block CI/CD on draft status - a lot of our teams have dependabot configured to create 1 PR at a time to avoid flooding the CI server with jobs - having them open as draft would solve that.

@infin8x infin8x added the F: pull-requests Issues about Dependabot pull requests label Jul 2, 2020
@carestad
Copy link

carestad commented Feb 1, 2021

It would serve as very useful in combination with Github Actions as well. Right now I am excluding workflows from being run on draft PRs, which could be very useful for dependabot PRs too.

I also believe #1963 is a duplicate here?

@Xavientois
Copy link

Has there been any movement on this? My team is also using draft status to block certain expensive CI checks and would like to use this approach with our dependabot PRs as well.

@benjaminhobbs
Copy link

Has there been any movement on this? My team is also using draft status to block certain expensive CI checks and would like to use this approach with our dependabot PRs as well.

AFAIK it's still not possible, but to save money on just the dependabot PRs you can use:
rebase-strategy: disabled

Then it'll only run when the PR is created and each time afterwards will require a manual rebase.

@mwaddell
Copy link
Contributor

You can already use either the PR's name or label to prevent running expensive CI checks. Draft is not available on private repositories for free accounts, so these solutions are more widely applicable than using "draft" to accomplish the same goal.

Option 1: Using PR name

Set a "[Draft]" prefix in the PR's name:

version: 2
updates:
  - package-ecosystem: npm
    directory: "/"
    schedule:
      interval: daily
      time: "11:00"
    commit-message:
      prefix: "[Draft]"

Set your github action to not run if that prefix exists, but to recheck when the name changes. When you want to "take it out of draft" you just rename the PR. To "put it back into draft" you rename it back.

on:
  pull_request:
    types: [ opened, synchronize, reopened, edited ]
    branches: [ main ]
      
jobs: 
  expensive_ci_job:
    if: !contains(github.event.pull_request.title, '[Draft]')
    name: Spend Money

Option 2: Using PR label

Set a "draft" label when the PR is created:

version: 2
updates:
  - package-ecosystem: npm
    directory: "/"
    schedule:
      interval: daily
      time: "11:00"
    labels:
      - "draft"

Set your github action to not run if that label exists, but to recheck when the labels change. When you want to "take it out of draft" you just remove the label. To "put it back into draft" you re-add the label:

on:
  pull_request:
    types: [ opened, synchronize, reopened, labeled, unlabeled ]
    branches: [ main ]
      
jobs: 
  expensive_ci_job:
    if: !contains( github.event.pull_request.labels.*.name, 'draft')
    name: Spend Money

@mwaddell
Copy link
Contributor

You can already use either the PR's name or label to prevent running expensive CI checks. Draft is not available on private repositories for free accounts, so these solutions are more widely applicable than using "draft" to accomplish the same goal.

Do note that the PR's name is set at initial creation, while the labels are set slightly afterwards, so if you're not using concurrency to kill previous jobs, using name instead of labels would be more reliable.

@q0rban
Copy link

q0rban commented Oct 13, 2022

+1

This is possible with Renovate https://docs.renovatebot.com/configuration-options/#draftpr.

@dependabot dependabot deleted a comment from stale bot Nov 15, 2022
@jeffwidman
Copy link
Member

@q0rban
Copy link

q0rban commented Oct 24, 2023

Any update on this in terms of when it might be planned? We provide a CI service that creates PR previews for various git providers including GitHub, and we get asked a lot about not building dependabot PRs, so having a create as draft option for dependabot PRs would be very helpful for GitHub customers.

@ShivamGoyal1899
Copy link

Do we have any updates here? seems like quite a lot of folks would like this.

@IvanRibakov
Copy link

Another use case (not related to CI) that would benefit from ability to create draft PRs is automatic PR review requests based on the code owners.
Right now, since PR is created as ready for review, reviews are requested asap. This creates unnecessary noise in situations when PR needs some manual polishing to ensure that CI passes. We would prefer the PR assignee to first look over the new PR and once it has been confirmed that everything is good - mark PR as ready for review which would then automatically request review of code owners and notify them.

@ernestostifano
Copy link

+1

@gregmagolan
Copy link

+1. This would be useful.

@hfvmarques
Copy link

I opened #9169 without seeing this issue. I think it would be very helpful.

@jonjanego jonjanego added the Keep Exempt this from being marked by stalebot label May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F: configuration-file F: pull-requests Issues about Dependabot pull requests Keep Exempt this from being marked by stalebot T: feature-request Requests for new features
Projects
None yet
Development

Successfully merging a pull request may close this issue.