{"id":24402291,"url":"https://github.com/p810/circleci-label-deploy-test","last_synced_at":"2026-04-21T08:06:07.622Z","repository":{"id":46972089,"uuid":"407923821","full_name":"p810/circleci-label-deploy-test","owner":"p810","description":"Proof of concept tool that can be used to trigger a pipeline in CircleCI in response to labels on a pull request","archived":false,"fork":false,"pushed_at":"2021-09-20T20:18:46.000Z","size":101,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-27T17:49:20.139Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/p810.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}},"created_at":"2021-09-18T17:23:48.000Z","updated_at":"2021-09-20T20:18:49.000Z","dependencies_parsed_at":"2022-09-23T17:22:25.955Z","dependency_job_id":null,"html_url":"https://github.com/p810/circleci-label-deploy-test","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/p810/circleci-label-deploy-test","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p810%2Fcircleci-label-deploy-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p810%2Fcircleci-label-deploy-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p810%2Fcircleci-label-deploy-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p810%2Fcircleci-label-deploy-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/p810","download_url":"https://codeload.github.com/p810/circleci-label-deploy-test/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p810%2Fcircleci-label-deploy-test/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32082790,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-21T06:27:27.065Z","status":"ssl_error","status_checked_at":"2026-04-21T06:27:21.250Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2025-01-20T00:59:53.403Z","updated_at":"2026-04-21T08:06:07.603Z","avatar_url":"https://github.com/p810.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# circleci-label-deploy-test\nThis is a quick proof of concept tool to kick off a pipeline in CircleCI when a specific label is added to a pull request in GitHub.\n\nThe program can be built either as a web app or as a GitHub Action since the payloads of the pull request events are the same for webhooks and actions. It would be best just to use GitHub Actions for everything in the latter case, but I mention this since it's one way of getting around having to spin up and manage a server, and it's free up to a certain point. I haven't yet written an integration that builds for a GitHub Action.\n\n## Usage\n### Prerequisites\nYou'll need [an API token for CircleCI](https://circleci.com/docs/2.0/managing-api-tokens/) and [a webhook on your project's repo](https://docs.github.com/en/developers/webhooks-and-events/webhooks/about-webhooks) that points to the URL you'll be serving the app behind. [ngrok](https://ngrok.com) is a good tool for testing the server locally.\n\nAfter cloning this repo open `.env.example` and populate it with your CircleCI token and [your webhook's secret token](https://docs.github.com/en/developers/webhooks-and-events/webhooks/securing-your-webhooks#setting-your-secret-token). You can also change the port that the server listens on and/or specify whether you want to use SHA1 or SHA256 for signature validation.\n\nSave the resulting file as `.env` and then open `src/labels.json`. Update this file to include the labels you want to react to and the parameters that should be sent to CircleCI when they're seen on a PR (this is explained further [below](#how-it-works)).\n\nThis project was built and tested with **Node 14.17.6**. At some point maybe I'll Dockerize this but the repo does include an [`.nvmrc`](https://github.com/nvm-sh/nvm).\n\n### Installation\n```sh\nyarn install\n```\n\nFollowing that any of the following commands should work:\n\n| Command          | Purpose                                                                        |\n|------------------|--------------------------------------------------------------------------------|\n| `yarn run dev`   | Runs the web server and automatically recompiles when source files are changed |\n| `yarn run build` | Builds the project and outputs it at `dist/index.js`                           |\n| `yarn run serve` | Runs the app after it's been built                                             |\n| `yarn run test`  | Runs the test suite for the app                                                |\n\nBy default the server listens on port `7890`.\n\n## How it works\nEach time a pull request is opened (including when it's reopened) or labeled, and whenever commits are pushed to the head branch, GitHub will notify your web app or action of this and the program will look to make sure that one or more expected labels are set on the PR.\n\nIt knows which labels to look for because of `src/labels.json`, which maps label names to a map of pipeline parameters and the value they should be when that label is set, e.g.:\n\n```json\n{\n  \"qa\": {\n    \"should_deploy_qa\": true\n  }\n}\n```\n\nFor events representing PRs that have the `qa` label, a request will be made to CircleCI's API that kicks off a pipeline for the head branch with the specified parameters. When multiple labels are matched all of the parameters will be set; any params that are shared between labels will be overwritten by whichever value comes last.\n\nThe API is currently only able to create new pipelines, and CircleCI's default integration already creates one for each commit and doesn't cancel redundant builds. Preventing redundant builds can be [enabled in a project's settings](https://circleci.com/docs/2.0/skip-build/#auto-cancelling-a-redundant-build), but if you can't do this then you can use conditions to skip other workflows. For example, if your API request sends `should_deploy_qa: true`, `unless` could be used to disable a workflow(s) in that case:\n\n```yml\nworkflows:\n  says_hello_world:\n    jobs:\n      - greet_world\n    when:\n      or:\n        - equal: [ master, \u003c\u003c pipeline.git.branch \u003e\u003e ]\n        - \u003c\u003c pipeline.parameters.should_greet_world \u003e\u003e\n  tells_the_time:\n    jobs:\n      - log_current_time\n    unless: \u003c\u003c pipeline.parameters.should_greet_world \u003e\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fp810%2Fcircleci-label-deploy-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fp810%2Fcircleci-label-deploy-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fp810%2Fcircleci-label-deploy-test/lists"}