{"id":15883082,"url":"https://github.com/plmercereau/drone-pr-merge","last_synced_at":"2025-07-25T20:42:44.387Z","repository":{"id":106019246,"uuid":"211913067","full_name":"plmercereau/drone-pr-merge","owner":"plmercereau","description":"GitHub PR merge \"event\" for Drone CI","archived":false,"fork":false,"pushed_at":"2019-10-01T11:10:08.000Z","size":16,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-28T00:37:01.642Z","etag":null,"topics":["ci-cd","drone-ci","github","github-api","pull-request","shell"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/plmercereau.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-30T17:13:11.000Z","updated_at":"2023-12-05T15:24:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"76fdb8c4-659c-4886-99d3-49a1fc4161b9","html_url":"https://github.com/plmercereau/drone-pr-merge","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plmercereau%2Fdrone-pr-merge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plmercereau%2Fdrone-pr-merge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plmercereau%2Fdrone-pr-merge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plmercereau%2Fdrone-pr-merge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/plmercereau","download_url":"https://codeload.github.com/plmercereau/drone-pr-merge/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243864809,"owners_count":20360360,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ci-cd","drone-ci","github","github-api","pull-request","shell"],"created_at":"2024-10-06T04:08:30.450Z","updated_at":"2025-03-17T14:31:35.989Z","avatar_url":"https://github.com/plmercereau.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Handling Pull Request mergers with Drone CD and the GitHub API\n\nThis is a very small example of a workaround to allow Drone.io to handle PR merge events.\nThis repo is rather a proof of concept, but contributions are welcome to make it more effective, while waiting for the Drone team to implement some kind of a 'pull_request_merge' event.\n\n### Rationale\n\nPipelines that deploy a temporary version of an application for each pull request are quite common.\nBut such on-the-fly environments then need to be destroyed once the pull request is merged.\nThis script coudl allow to reach the branch of origin once the PR is merged, to destroy the environment that would have been created with the PR.\n\n### Requirements\n\nThe script requires `jq` and `curl` (not installed in Alpine by default).\n\n### How it works\n\nThe `get_merged_branch.sh` script reaches the GitHub API to get the right information from the GitHub API, and prints the orginial branch of the PR.\n\nThis script can be then called in a Drone pipeline (or any similar CI/CD platform). In the `.drone.yml` of this repo, the output is stored in an environment variable: `export MERGED_FROM_BRANCH=$(./get_merged_branch.sh)`. If the output is empty, then the ongoing step stops with `'[[ -z $MERGED_FROM_BRANCH ]] \u0026\u0026 exit'`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplmercereau%2Fdrone-pr-merge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplmercereau%2Fdrone-pr-merge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplmercereau%2Fdrone-pr-merge/lists"}