{"id":16857644,"url":"https://github.com/miekg/dreck","last_synced_at":"2025-04-11T07:45:14.576Z","repository":{"id":56433745,"uuid":"132254271","full_name":"miekg/dreck","owner":"miekg","description":"Bot to help with GitHub chores ","archived":false,"fork":false,"pushed_at":"2020-11-11T12:29:37.000Z","size":15477,"stargazers_count":12,"open_issues_count":0,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-25T05:18:11.879Z","etag":null,"topics":["caddy","ci-bot","coredns","derek","github","github-app","go"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/miekg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null}},"created_at":"2018-05-05T14:17:01.000Z","updated_at":"2022-03-01T20:49:31.000Z","dependencies_parsed_at":"2022-08-15T18:40:21.136Z","dependency_job_id":null,"html_url":"https://github.com/miekg/dreck","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miekg%2Fdreck","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miekg%2Fdreck/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miekg%2Fdreck/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miekg%2Fdreck/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/miekg","download_url":"https://codeload.github.com/miekg/dreck/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248359336,"owners_count":21090509,"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":["caddy","ci-bot","coredns","derek","github","github-app","go"],"created_at":"2024-10-13T14:08:53.668Z","updated_at":"2025-04-11T07:45:14.551Z","avatar_url":"https://github.com/miekg.png","language":"Go","readme":"# Dreck\n\n[![Build\nStatus](https://travis-ci.org/miekg/dreck.svg?branch=master)](https://travis-ci.org/miekg/dreck)\n\n*dreck* is a fork of [Derek](https://github.com/alexellis/derek). It adds Caddy integration,\nso you can \"just\" run it as a plugin in Caddy v1. It also massively expands on the number\nof features. *Dreck* depends on the GitHub CODEOWNERS feature and it will check if that\nfile exist. A separate `.dreck.yaml` contains various things that are not captured in the\n[CODEOWNERS](https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners)\nfile. Dreck doesn't support the email address syntax, so be sure to use GitHub usernames here.\n\n*Dreck* can help you with managing pull requests and issues in your GitHub project. Dreck currently\ncan:\n\n*  Label/close/lock etc. issues and pull requests comments.\n\n*  LGTM a pull request with a comment.\n\n*  Merge a pull request, but only when the checks are OK and with at least 1 LGTM (/merge).\n\n*  Define (shorter) alias for often used commands.\n\n*  Execute (whitelisted) commands on the dreck server.\n\nThe commands must be given as the first word(s) on a line, multiple commands (up to 10) are allowed\nbut we return on the first error encountered. This holds true for comments that are submitted via\nemail. Opening issues and pull requests is handled differently in Github, but all commands are\nsupported in there as well.\n\nCommands are detected in a case insensitive manner.\n\nFor this all to work, you'll need to have an Github App that allows access to your repository.\nYou'll need:\n\n* Issues\n* Pull Requests\n* Issue Comments\n\nAnd need to compile Caddy with this plugin.\n\n## Config in caddy\n\nIf configuring Caddy, you need to recompile it with the *dreck* plugin enabled. After that the\nfollowing configuration is available.\n\n~~~\ndreck {\n    client_id ID\n    private_key PATH\n    owners NAME\n    secret SECRET\n    path PATH\n    merge STRATEGY\n    validate\n    user USER\n    env NAME VALUE\n}\n~~~\n\n*  `client_id` is mandatory and must be the client **ID** of the Github App.\n\n*  `private_key` specifies the **PATH** of the private key of the Github App. This is also\n   mandatory.\n\n*  `secret` specify a **SECRET** for the webhook. This is mandatory.\n\n*  `validate` enable HMAC validation of the request, using the secret. This is mandatory.\n\n*  `owners` can optionally specify a **NAME** for the .dreck.yaml file, defaults to \".dreck.yaml\".\n\n*  `path` trigger Dreck when the webhook hits **PATH**, defaults to \"/dreck\".\n\n*  `merge` defines the **STRATEGY** for merging, possible values are `merge`, `squash` or `rebase`,\n   it defaults to `squash`.\n\n*  `user` specifies the **USER** to be used for executing commands. This defaults to the user\n   running Caddy.\n\n*  `env` defines environment variable with **NAME** and assign it **VALUE**. These may be repeated.\n   Any executed command will have these variables in their environment.\n\n## .dreck.yaml File Syntax\n\nThe `.dreck.yaml` file has `features` and `aliases` section that allows you to configure dreck. This\nfile should live in the top level directory of the repository.\n\n~~~ yaml\nfeatures:\n    - feature1\n    - feature2\n\naliases:\n    - |\n      alias1\n    - |\n      alias2\n~~~\n\nAn example:\n\n~~~ yaml\nfeatures:\n    - exec\n    - aliases\naliases:\n    - |\n      /plugin (.*) -\u003e /label add plugin/$1\n    - |\n      /release (.*) -\u003e /exec /opt/bin/release $1\n~~~\n\n### Features\n\nThe comment handling feature is always enabled, so you will most like only used this for,\n`aliases` and `exec`.\n\nThe following features are available.\n\n*  `aliases` - enable alias expansion.\n\n*  `exec` - enables `/exec`.\n\n## Supported Commands\n\nThe following commands are supported in issue comments and pull requests. When referencing\na user you can use **USER** or **@USER**. Most commands are only available to user referenced in the\nCODEOWNERS file. Commands comming from bots (`[bot]` as suffix) are ignored.\n\n*  `/[un]label LABEL`, add/remove a label.\n\n*  `/[un]assign USER`, [un]assign issue to **USER**, the empty string can be used as a\n    shortcut for the current user.\n\n*  `/close`, close issue.\n\n*  `/reopen`, reopen issue.\n\n*  `/title TITLE`, set the title for this issue to **TITLE**.\n\n*  `/[un]lock`, [un]lock the issue.\n\n*  `/[un]cc USER`, [un]cc **USER** request a review from this user, empty string means the current user.\n\n*  `/[un]lgtm`, [un]approve the pull request, this adds a comment that it was LGTM-ed by the user issuing\n   this command and adds an approve by the bot.\n\n*  `/[un]approve`, alternative for lgtm.\n\n*  `/merge`, merge this pull request if the checks are green and we have approval (and no explicit\n   changes requested).\n\n*  `/exec COMMAND`, executes **COMMAND** on the dreck server. Only commands via an expanded alias\n   are allowed.\n\n*  `/duplicate NUMBER`, mark this issue as a duplicate of **NUMBER**. This is done by closing the issue\n   and adding the 'duplicate' label.\n\n*  `/fortune`, adds a comment containing text obtained from running \"fortune\".\n\n## Aliases\n\nThe `aliases` sections of the .dreck.yaml allows you to specify alias for other commands. It's\na regular expression based format and looks like this: `alias -\u003e command`. Note the this is:\n`\u003cspace\u003e-\u003e\u003cspace\u003e`, e.g.:\n\n    /plugin (.*) -\u003e /label plugin/$1\n\nThis defines a new command `/plugin forward` that translates into `/label plugin/forward`.\nThe regular expression `(.*)` catches the argument after `/plugin` and `$1` is the first expression\nmatch group.\n\nNote this entire string needs to be taken literal to be valid yaml:\n\n~~~ yaml\naliases:\n    - |\n      /plugin (.*) -\u003e /label plugin/$1\n~~~\n\n## Exec\n\nExec allows for processes be started on the dreck server. For this the `exec` feature *and* the\n`aliases` feature must be enabled. Only commands *expanded* by an alias are allowed to execute, this\nis to prevent things like `/exec /bin/cat /etc/passwd` to be run accidentally. The standard output\nof the command will be picked up and put in the new comment under the issue or pull request.\n\nIf `user` is specified dreck will run the command under that user.\n\nApart from the environment set in the configuration all command well have access to GITHUB\\_TRIGGER.\nIf the command is given in an issue dreck will set GITHUB\\_TRIGGER to `issue/NUMBER`, if done for a\npull request that value will be `pull/NUMBER`.\n\nIf the command is run for a pull request dreck will update the status with 'pending' when the\nexecution is in progress and either 'failed' or 'success' when the execution ends.\n\nFor example, if you want to execute `/opt/bin/release ARGUMENT` on the server, the following alias\nmust be defined:\n\n~~~\n/release (.*) -\u003e /exec /opt/bin/release $1\n~~~\n\nIf you then call the command with `/release 0.1` in issue 42. *dreck* will run:\n\n~~~\n/opt/bin/release 0.1\n~~~\n\nAnd GITHUB\\_TRIGGER will be issue/42.\n\nNote that in this case `/cat -\u003e /exec /bin/cat /etc/resolv.conf`, running `cat /etc/passwd`\n*still* yields in an (unwanted?) disclosure because the final command being run is `/bin/cat\n/etc/resolv.conf /etc/passwd`. In other words be careful of what commands you white list.\n\n*dreck* enforces a very restrictive white list on the allowed characters in the command. The white\nlist currently is this regular expression: `^[-a-zA-Z0-9 ./]+$`. Note that two dots in a row is not\nallowed.\n\n# Examples\n\nSet a label on an issue, on Github (or via email), create a reply that contains:\n\n~~~\n/label bug\n~~~\n\nAnd *dreck* will apply that label if it exists. Text can freely intermixed, but each command should\nbe on its own line and start on the left most position.\n\n~~~\nThis is good question.\n/label question\n~~~\n\nWhile the following will not be detected as a command:\n\n~~~\nThis is good question. /label question\n~~~\n\n# Also See\n\nSee [Derek](https://github.com/alexellis/derek) of which dreck is a fork.\n\n# Adding in Caddy\n\nApply a patch like the following:\n\n~~~ patch\ndiff --git caddyhttp/caddyhttp.go caddyhttp/caddyhttp.go\nindex 7ca8b874..34b8b405 100644\n--- caddyhttp/caddyhttp.go\n+++ caddyhttp/caddyhttp.go\n@@ -46,4 +46,6 @@ import (\n        _ \"github.com/caddyserver/caddy/caddyhttp/timeouts\"\n        _ \"github.com/caddyserver/caddy/caddyhttp/websocket\"\n        _ \"github.com/caddyserver/caddy/onevent\"\n+\n+       _ \"github.com/miekg/dreck\"\n )\ndiff --git caddyhttp/httpserver/plugin.go caddyhttp/httpserver/plugin.go\nindex 378e9cb8..79498579 100644\n--- caddyhttp/httpserver/plugin.go\n+++ caddyhttp/httpserver/plugin.go\n@@ -701,6 +701,7 @@ var directives = []string{\n        \"restic\",    // github.com/restic/caddy\n        \"wkd\",       // github.com/emersion/caddy-wkd\n        \"dyndns\",    // github.com/linkonoid/caddy-dyndns\n+       \"dreck\",     // \"github.com/miekg/dreck\"\n }\n\n const (\n~~~\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiekg%2Fdreck","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmiekg%2Fdreck","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiekg%2Fdreck/lists"}