{"id":28486541,"url":"https://github.com/opentable/mercury-bot","last_synced_at":"2025-07-03T03:31:02.954Z","repository":{"id":31902143,"uuid":"128419942","full_name":"opentable/mercury-bot","owner":"opentable","description":"Mercury is a bot for handling in-code static translations. ","archived":false,"fork":false,"pushed_at":"2025-04-09T13:05:18.000Z","size":1575,"stargazers_count":20,"open_issues_count":11,"forks_count":7,"subscribers_count":21,"default_branch":"master","last_synced_at":"2025-06-08T01:43:31.677Z","etag":null,"topics":["bot","github","smartling","translations"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/mercury-bot","language":"JavaScript","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/opentable.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2018-04-06T16:36:28.000Z","updated_at":"2025-04-09T13:05:22.000Z","dependencies_parsed_at":"2024-11-30T17:38:50.978Z","dependency_job_id":null,"html_url":"https://github.com/opentable/mercury-bot","commit_stats":{"total_commits":377,"total_committers":18,"mean_commits":"20.944444444444443","dds":0.389920424403183,"last_synced_commit":"e4da01e20b15a49311784152c66415ac7350a7ab"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/opentable/mercury-bot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opentable%2Fmercury-bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opentable%2Fmercury-bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opentable%2Fmercury-bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opentable%2Fmercury-bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/opentable","download_url":"https://codeload.github.com/opentable/mercury-bot/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opentable%2Fmercury-bot/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263253311,"owners_count":23437836,"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":["bot","github","smartling","translations"],"created_at":"2025-06-08T01:35:11.060Z","updated_at":"2025-07-03T03:31:02.945Z","avatar_url":"https://github.com/opentable.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n    \u003cimg width=\"200\" height=\"200\" src=\"docs/mercury-logo.png\"\u003e\n\n\u003cbr\u003e\n\u003cbr\u003e\n\u003ch1\u003eMercury\u003c/h1\u003e\n\u003cp\u003eMercury is a bot for handling in-code static translations. Developed at \u003ca href=\"https://www.opentable.com\"\u003eOpenTable\u003c/a\u003e, it takes care of dozens of codebases by making automated Pull Requests to keep the code up to date with our translations.\u003c/p\u003e\n\u003c/div\u003e\n\n***\n\n### How Mercury works\n\nThe bot looks for a `mercury.json` manifest file in a repository's root. It then locates the source files and keeps them updated with [Smartling](https://smartling.com/) by using its API and making Pull Requests. Please refer to the [Mercury consumer integration runbook](https://github.com/opentable/mercury-bot/blob/master/docs/integration-runbook.md) and [FAQ](https://github.com/opentable/mercury-bot/blob/master/docs/faq.md).\n\n![Mercury screenshot](docs/screenshot.png)\n\n### How to setup the bot in your organization\n\nMercury is available as [npm module](https://www.npmjs.com/package/mercury-bot) and needs to be configured to run with github and smartling API tokens.\n\nHere is a code example:\n\n```js\nconst mercury = require('mercury-bot');\n\nconst config = {\n  github: {\n    apiTokens: [\n      { operation: 'read', value: 'token-1234567890' },\n      { operation: 'write', value: 'token-0987654321' }\n    ],\n    owner: 'mercurybot',\n    branch: 'mercury'\n  },\n  smartling: {\n    userIdentifier: 'userId-1234567890',\n    userSecret: 'userSecret-0987654321'\n  },\n  repositories: {\n    'github-org': ['repo1', 'repo2']\n  }\n};\n\nconst app = mercury({ config });\n\n// Optional event handlers\napp.on('error', console.log);\napp.on('action', console.log);\napp.on('result', console.log);\n\n// Run\napp.run(() =\u003e process.exit(0));\n```\n\n#### API\n\n##### Init mercury({ config })\n\n`config` is an object that requires the following structure:\n\n|name|type|mandatory|description|\n|----|----|---------|-----------|\n|`github`|`object`|`yes`|Github config|\n|`github.apiTokens`|`object`|`yes`|Github API Tokens. You need at least one read token and one write token|\n|`github.apiTokens[index].operation`|`string`|`yes`|Can be either `read` or `write`|\n|`github.apiTokens[index].value`|`string`|`yes`|The token|\n|`github.owner`|`string`|`yes`|The github user associated with the token|\n|`github.branch`|`string`|`yes`|The branch that the bot will use to make Pull Requests on his fork|\n|`repositories`|`object`|`yes`|The repositories mercury needs to watch and manage|\n|`repositories[index]`|`array of strings`|`yes`|The github org that contains the repos to watch|\n|`repositories[index][item]`|`string`|`yes`|The github repo to watch|\n|`smartling`|`object`|`yes`|The smartling config|\n|`smartling.userIdentifier`|`string`|`yes`|The smartling UserId|\n|`smartling.userSecret`|`string`|`yes`|The smartling UserSecret|\n|`bucketsCount`|`number`|`no`|Buckets count. The current bucket is selected based on the current UTC hour. The value must be between 1 and 24. The default value is 1|\n\n##### mercury.on(eventName, payload)\n\nEvent handler for connecting to a logger. The following events are emitted:\n\n|name|payload object props|description|\n|----|--------------------|-----------|\n|`action`|`{ message}`|The message contains a description of the performed action|\n|`error`|`{ error, errorType, details }`|The error is a Javascript `Error` object containing the whole stacktrace. The errorType is a string identifier for the error, and the details contains all the state of the performed actions for the current repository for further investigation|\n|`result`|`{ message, resultType }`|The message contains a description of the performed action, the resultType is an identifier for the current action|\n\n#### License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopentable%2Fmercury-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopentable%2Fmercury-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopentable%2Fmercury-bot/lists"}