Coder Social home page Coder Social logo

svanboxel / delete-merged-branch Goto Github PK

View Code? Open in Web Editor NEW
324.0 11.0 55.0 2.62 MB

No more manually deleting merged branches, this lovely app does it for you.

Home Page: https://github.com/apps/delete-merged-branch/

License: ISC License

JavaScript 97.65% Shell 2.35%
probot

delete-merged-branch's Issues

Deprecated error object key

07:29:55.916Z  INFO probot: Loaded delete-merged-branch GitHub Application
Deprecation: [@octokit/request-error] `error.code` is deprecated, use `error.status`.
    at RequestError.get (/home/runner/work/_actions/SvanBoxel/delete-merged-branch/main/dist/index.js:15092:17)
    at Object.Logger.stdSerializers.err (/home/runner/work/_actions/SvanBoxel/delete-merged-branch/main/dist/index.js:2735[6](https://github.com/tokenx-finance/tkx-oracle-service/runs/8151391728?check_suite_focus=true#step:2:7):19)
    at mkRecord (/home/runner/work/_actions/SvanBoxel/delete-merged-branch/main/dist/index.js:2[7](https://github.com/tokenx-finance/tkx-oracle-service/runs/8151391728?check_suite_focus=true#step:2:8)150:35)
    at Logger.warn (/home/runner/work/_actions/SvanBoxel/delete-merged-branch/main/dist/index.js:27252:1[9](https://github.com/tokenx-finance/tkx-oracle-service/runs/8151391728?check_suite_focus=true#step:2:10))
    at module.exports (/home/runner/work/_actions/SvanBoxel/delete-merged-branch/main/dist/index.js:64:17)

Automatic change of base branch does not work

Hey,

I am faced with following use case, where 3 PRs exist, PR number 2 is being merged, and consequently branchC is being removed:

  1. branchB -> branchA
  2. branchC -> branchB
  3. branchD -> branchC

The behavior of delete-merged-branch integration is slightly different compared to the native Automatically delete head branches repository option:

  • integration: branchC is removed, PR number 3 shows a message that This branch has conflicts that must be resolved and manual change of base branch is required

  • native: branchC is also removed, however base branch in PR number 3 is automatically changed with the following message shown Base automatically changed from branchC to branchB

Is there an option to make the integration work the same as the native one?

Consider publishing as npm module

To use this github app with @probot/serverless-lambda or @probot/serverless-gcf would be useful to have this app available as an npm package. Then can do something like

const serverless = require('@probot/serverless-lambda')
const appFn = require('delete-merged-branch')
module.exports.probot = serverless(appFn)

Would you consider publishing this as an npm module?

Unable to delete branches suddenly

Thank you for creating this GitHub Action.

However, recently all our workflows are failing with below error:

2024-06-13T16:29:54.9267760Z Download action repository 'SvanBoxel/delete-merged-branch@main' (SHA:2b5b058e3db41a3328fd9a6a58fd4c2545a14353)
2024-06-13T16:29:55.4175299Z Complete job name: delete-branch
2024-06-13T16:29:55.5162644Z ##[group]Run SvanBoxel/delete-merged-branch@main
2024-06-13T16:29:55.5163384Z with:
2024-06-13T16:29:55.5163749Z env:
2024-06-13T16:29:55.5164357Z   GITHUB_TOKEN: ***
2024-06-13T16:29:55.5164830Z ##[endgroup]
2024-06-13T16:29:55.8058704Z 16:29:55.799Z  INFO probot: Loaded delete-merged-branch GitHub Application
2024-06-13T16:30:10.4118946Z Deprecation: [@octokit/request-error] `error.code` is deprecated, use `error.status`.
2024-06-13T16:30:10.4121833Z     at RequestError.get (/home/runner/work/_actions/SvanBoxel/delete-merged-branch/main/dist/index.js:15092:17)
2024-06-13T16:30:10.4124827Z     at Object.Logger.stdSerializers.err (/home/runner/work/_actions/SvanBoxel/delete-merged-branch/main/dist/index.js:27356:19)
2024-06-13T16:30:10.4127225Z 16:30:10.411Z ERROR event: Not Found (id=acc3c91a-5818-467e-bf35-720f5ca7df58)
2024-06-13T16:30:10.4130820Z     at /home/runner/work/_actions/SvanBoxel/delete-merged-branch/main/dist/index.js:27081:50
2024-06-13T16:30:10.4132489Z     at Array.forEach (<anonymous>)
2024-06-13T16:30:10.4134345Z     at Logger._applySerializers (/home/runner/work/_actions/SvanBoxel/delete-merged-branch/main/dist/index.js:27073:35)
2024-06-13T16:30:10.4136515Z     at mkRecord (/home/runner/work/_actions/SvanBoxel/delete-merged-branch/main/dist/index.js:27186:17)
2024-06-13T16:30:10.4138470Z     at Logger.error (/home/runner/work/_actions/SvanBoxel/delete-merged-branch/main/dist/index.js:27252:19)
2024-06-13T16:30:10.4140562Z     at Application.<anonymous> (/home/runner/work/_actions/SvanBoxel/delete-merged-branch/main/dist/index.js:84794:33)
2024-06-13T16:30:10.4142576Z     at step (/home/runner/work/_actions/SvanBoxel/delete-merged-branch/main/dist/index.js:84675:23)
2024-06-13T16:30:10.4144480Z     at Object.throw (/home/runner/work/_actions/SvanBoxel/delete-merged-branch/main/dist/index.js:84656:53)
2024-06-13T16:30:10.4146396Z     at rejected (/home/runner/work/_actions/SvanBoxel/delete-merged-branch/main/dist/index.js:84648:65)
2024-06-13T16:30:10.4152523Z   HttpError: Not Found
2024-06-13T16:30:10.4154374Z       at /home/runner/work/_actions/SvanBoxel/delete-merged-branch/main/dist/index.js:15192:23
2024-06-13T16:30:10.4155844Z       at processTicksAndRejections (node:internal/process/task_queues:96:5)
2024-06-13T16:30:10.4157554Z       at async Job.doExecute (/home/runner/work/_actions/SvanBoxel/delete-merged-branch/main/dist/index.js:23942:18)
2024-06-13T16:30:10.4158776Z   --
2024-06-13T16:30:10.4161411Z   event: {
2024-06-13T16:30:10.4162052Z     "event": "pull_request.closed",
2024-06-13T16:30:10.4162949Z     "id": "acc3c91a-5818-467e-bf35-720f5ca7df58",
2024-06-13T16:30:10.4164100Z     "repository": "opensearch-project/opensearch-build-libraries"
2024-06-13T16:30:10.4164915Z   }
2024-06-13T16:30:10.4197401Z ##[error]Action failed with error: Not Found
2024-06-13T16:30:10.4206952Z 16:30:10.412Z ERROR probot: Not Found
2024-06-13T16:30:10.4207925Z   HttpError: Not Found
2024-06-13T16:30:10.4209215Z       at /home/runner/work/_actions/SvanBoxel/delete-merged-branch/main/dist/index.js:15192:23
2024-06-13T16:30:10.4210748Z       at processTicksAndRejections (node:internal/process/task_queues:96:5)
2024-06-13T16:30:10.4212789Z       at async Job.doExecute (/home/runner/work/_actions/SvanBoxel/delete-merged-branch/main/dist/index.js:23942:18)

https://github.com/opensearch-project/opensearch-build-libraries/actions/runs/9503330318/job/26193506264#step:2:30

Did something change or need permission updates or something?

Only delete on certain base branches

We can currently exclude based on the head branch of a PR. We want to be able to choose to only delete head on branches that are merged to a given base branch. An example would be the following

on_base:
  - main
  - qa

This would act as a whitelist, so if a PR targets dev, it would not cause the source branch to be deleted.

I'm working on adding this now, just opening the issue to have a number.

feature request: auto docker push

Hi there,
I love your deployment process, I want to deploy your app in docker, I'd love if you could publish docker automatically.

I also use semantic-release for versioning, now.sh as lambda function, but in semantic-release, I also push my image to docker hub. Here's a sample: https://github.com/fossapps/MergeWhenReady

It'd be amazing if you could push to docker hub, and I'd just use the app by setting some env variable like so:

APP_ID=""
WEBHOOK_SECRET=""
BASE64_PRIVATE_KEY=""
GHE_HOST="github.private-domain.com"

Thanks, I'd be willing to help you out with this.

feat: delete except specific branches

hi. Thank you for making a good bot. I'm using it well.

However, there is a function that I need. I am running a branch called develop, master, and a release unit distribution branchs. even if these branches are merged, they must not be deleted. Is there a device that can add a branch that shouldn't be deleted?

Exclude branches in Git Actions

Big thanks for the solution. I have a question - how to add excluded branches in Git Actions .yml file?
Is this right?

     env:
         exclude: [development]
         GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Github Teams Support

Hi,

We would like to adopt this app for our org (I used it at my old place and it was awesome) but do not want it across every repo.

Please add a way to limit it to a teams repos only.

Thanks!

Not working in github action

I am trying to implement this using github action but its not working.
workflow action keeps on running with progress status neither fails nor succeeds

My action template:

name: Delete Merged Branches

on: [pull_request]

jobs:
  delete:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
        with:
          # Make sure the actual branch is checked out when running on pull requests
          ref: ${{ github.head_ref }}

      - name: Delete merged branch
        uses: SvanBoxel/[email protected]
        with:
          exclude: staging
          delete_closed_pr: false
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

[doc request] Now configuration

Hi, I'm a big fan of your probot bot and currently using it in several of my work projects, and I'm trying to actually build one for my own, and was wondering if you could share the now.json file.

In other words, I'm trying to build my own but a bit more custom.

Here is the use case.
We currently have a Jenkins instance that is an internal application but we store the code in Github, so ideally the probot will listen to any pull_request.* and then publish that information to a sns topic which then Lambda will listen to that SNS and then send it to the Jenkins API with the right keys

Yes, its a bit convoluted but its a regular use case that I have seen in many places, and now usually most people just do git pulls every X minutes instead of having a "listen mechanism".

I have part of it done, but your use of now made it for me easier that it can be configured per client since there is the configuration of the sns topic / keys that are specific to each client

Finalizing, can you share the now.json file? From what I can see travis will kind of create it for you , but I might be wrong.

Any help is appreciated!

This appears to have stopped working on our org repos

Hi - I have deleted and reinstalled the bot but it is no longer deleted merged branches. Is there anything else I should try. Does it work OK if someone has enabled the Github setting to do the same. I prefer the bot since it's easier to enable at org level. Thanks!

could this please be expanded to use pull_request_target?

I was hoping to use this in a project, however, we lock down things using pull_request_target for our merges (only delete after after everything is released).

Is there a way to expand this action to also check (or optionally check) for pull_request_target?

The behavior today, is that it will run this action, but no action is taken place and the branch remains.

Upgrade Action to use node 16 instead of node 12

Following the recent blog post "GitHub Actions: All Actions will begin running on Node16 instead of Node12" by GitHub, I noticed this action is still running on node12:

action.yml

runs:
  using: 'node12'
  main: 'dist/index.js'

This is the warning I see every time I my workflow:

Node.js 12 actions are deprecated. For more information see: https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/. Please update the following actions to use Node.js 16: SvanBoxel/[email protected]

This feature already exists

Hello amigos,

Im just wondering if is necessary to continue working on this project if this feature already exists :/ You can find it on repository configuration

Screen Shot 2019-11-24 at 01 15 40

Probably this action could be better if you offer more features that github currently gives

Automatically deploy new versions to now

Is your feature request related to a problem? Please describe.
At the moment new versions of this app are manually deployed to Now. This should happen automatically on every release.

Describe the solution you'd like
Make the deploy process part of CI.

[bug] GitHub Action hanging

The github action doesn't appear to work. I've cancelled a couple of tasks after 15min of activity and the logs show the following after getting everything setup

...
Already have image (with digest): gcr.io/github-actions-images/action-runner:latest
14:35:13.811Z  INFO probot: Listening on http://localhost:3000
14:35:13.814Z  INFO probot:
  
  Welcome to Probot! Go to http://localhost:3000 to get started.

[feature-request] ability to delay deletion

Would be awesome to be able to delay deletion of a branch.

Use case: Sometimes Iโ€™m working on a feature branch and it gets approved and merged. Later, a bug gets noticed and I go to pull the latest copy of that branch as it was right before merge (to handle cases, for instance, if there had been edits before approval on remote only, or to avoid pulling from master where there may potentially be new commits), though this typically would only be within a set period of time (ie. maybe typically within the first 7 days after initial merge)

Would be nice to account for scenarios like this and be able to access the branch without having to restore first, but still have it auto deleted after a set period of time

Also, thanks a ton as-is for this @SvanBoxel def a fan!

Also, would most definitely be more than happy to help and can most def queue up circling back around here!

master branch getting deleted

Since installing this plugin, we've been having issues with our master branches getting deleted.

Example Scenario:

  1. Repository has its default branch set to master.
  2. User1 makes a PR from their fork (User1 wants to merge 1 commit into OrgName:master from User1:master).
  3. PR gets merged.
  4. OrgName:master branch is deleted and the default branch is set to one of the other branches on the repository.

Our testing indicates that this issue does not occur if the PR is from a non-master fork branch (User1 wants to merge 1 commit into OrgName:master from User1:NewFeatureBranch).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.