svanboxel / delete-merged-branch Goto Github PK
View Code? Open in Web Editor NEWNo more manually deleting merged branches, this lovely app does it for you.
Home Page: https://github.com/apps/delete-merged-branch/
License: ISC License
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
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)
Hey,
I am faced with following use case, where 3 PRs exist, PR number 2 is being merged, and consequently branchC is being removed:
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?
exclude
Should exclude release_A, release_B etc.
Sometimes it makes sense to merge the master into an existing branch to continue working on the existing branch before merging it with the master. Therefore it would be nice to exclude the master branch from deletion by default.
Use case:
Other than feature branches, I have multiple release branches which time to time merge into master.
Though it will be great to have the feature branches deleted automatically, is it possible to exempt certain branches?
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?
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)
Did something change or need permission updates or something?
Looks like the simplest use case is now covered by github. I thought to let you know!
In any case thanks for this great bot. A pleasure to use so far!
Automatically delete head branches of pull requests
Repositories can now be set to delete the head branch of a pull request once it has merged into the base branch.
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.
I suggest upgrading Probot to the latest version.
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.
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?
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 }}
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!
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 }}
Make this app compatible with GitHub Actions, so I don't have to run it myself.
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!
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!
Is it possible to have branches that are merged from forks automatically deleted?
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.
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]
Can you please explain why Read and write access to administration
is needed?
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.
Do build and release via GitHub Actions instead of Travis-CI
delete-merged-branch/lib/delete-merged-branch.js
Lines 21 to 24 in ecb075b
I think yml file should allow a config which will also delete a branch if it's closed.
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.
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!
I think you reset the tokens so semantic-release is failing, do you mind setting it up again? Thanks.
Since installing this plugin, we've been having issues with our master branches getting deleted.
Example Scenario:
master
.OrgName:master
from User1:master
).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
).
It would be handy if similar to exclude
we could set an array of labels that, when present, prevent the branch from being deleted!
First, thanks for the work, it looks amazing!
In my organization, I would be interested in it but not all members are. Could there be a setting to choose for whom it is enabled?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.