From 11558e816ebba643e0e76967bf2cfa82bdbcaeef Mon Sep 17 00:00:00 2001 From: Ash Wilson Date: Tue, 7 May 2019 10:42:56 -0400 Subject: [PATCH 01/12] Boilerplate stuff --- actions/auto-sprint/Dockerfile | 18 + actions/auto-sprint/index.js | 13 + actions/auto-sprint/package-lock.json | 632 ++++++++++++++++++++++++++ actions/auto-sprint/package.json | 11 + 4 files changed, 674 insertions(+) create mode 100644 actions/auto-sprint/Dockerfile create mode 100644 actions/auto-sprint/index.js create mode 100644 actions/auto-sprint/package-lock.json create mode 100644 actions/auto-sprint/package.json diff --git a/actions/auto-sprint/Dockerfile b/actions/auto-sprint/Dockerfile new file mode 100644 index 0000000000..5102da120c --- /dev/null +++ b/actions/auto-sprint/Dockerfile @@ -0,0 +1,18 @@ +FROM node:8-slim + +LABEL "com.github.actions.name"="auto-sprint" +LABEL "com.github.actions.description"="Add opened pull requests and assigned issues to the current sprint project" +LABEL "com.github.actions.icon"="list" +LABEL "com.github.actions.color"="white" + +# Copy the package.json and package-lock.json +COPY package*.json ./ + +# Install dependencies +RUN npm ci + +# Copy the rest of your action's code +COPY . / + +# Run `node /index.js` +ENTRYPOINT ["node", "/index.js"] diff --git a/actions/auto-sprint/index.js b/actions/auto-sprint/index.js new file mode 100644 index 0000000000..075f9b10dd --- /dev/null +++ b/actions/auto-sprint/index.js @@ -0,0 +1,13 @@ +const {Toolkit} = require('actions-toolkit'); + +Toolkit.run(tools => { + // Ensure that the actor of the triggering action is one of us + + // Identify the active sprint board + + // Add the issue/pull request to the sprint board + tools.exit.success('We did it!'); +}, { + event: ['issues.assigned', 'pull_request.opened'], + secrets: ['GITHUB_TOKEN'], +}); diff --git a/actions/auto-sprint/package-lock.json b/actions/auto-sprint/package-lock.json new file mode 100644 index 0000000000..7c4faa242b --- /dev/null +++ b/actions/auto-sprint/package-lock.json @@ -0,0 +1,632 @@ +{ + "name": "auto-sprint", + "requires": true, + "lockfileVersion": 1, + "dependencies": { + "@octokit/endpoint": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-4.2.2.tgz", + "integrity": "sha512-5IZjkUNhx5q0IRN7Juwf5A+Lu2qAso7ULST7C1P2mbGHePuCOk936Stcl/5GdJpB3ovD8M6/Lv3xra6Mn0IKNQ==", + "requires": { + "deepmerge": "3.2.0", + "is-plain-object": "^3.0.0", + "universal-user-agent": "^2.0.1", + "url-template": "^2.0.8" + } + }, + "@octokit/graphql": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-2.1.1.tgz", + "integrity": "sha512-BVRBRFulb2H42u/Slt+x59tFw7lRf94xX9/Dv++mYDmYRXaY6LIOzrCTY2GYOVQVcoBjPhfEiYAMuJUCPNoe2g==", + "requires": { + "@octokit/request": "^3.0.0", + "universal-user-agent": "^2.0.3" + } + }, + "@octokit/request": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@octokit/request/-/request-3.0.1.tgz", + "integrity": "sha512-aH61OVkMKMofGW/go2x4mJ44X4U/JF8xsiFFictwkZYtz0psE8OPKpsP2TZBZaJoCg2wmeTyEgqGfY+veg0hGQ==", + "requires": { + "@octokit/endpoint": "^4.0.0", + "deprecation": "^1.0.1", + "is-plain-object": "^3.0.0", + "node-fetch": "^2.3.0", + "once": "^1.4.0", + "universal-user-agent": "^2.0.1" + } + }, + "@octokit/rest": { + "version": "16.25.2", + "resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-16.25.2.tgz", + "integrity": "sha512-aUSzvY33dz6RMLLmT+1aNc2OvvAmDfdXKaOzFEEBNJjsjckNjWkB2hgGa5plnnbuLPCloVldPuAdm+8REZGLcg==", + "requires": { + "@octokit/request": "3.0.1", + "atob-lite": "^2.0.0", + "before-after-hook": "^1.4.0", + "btoa-lite": "^1.0.0", + "deprecation": "^1.0.1", + "lodash.get": "^4.4.2", + "lodash.set": "^4.3.2", + "lodash.uniq": "^4.5.0", + "octokit-pagination-methods": "^1.1.0", + "once": "^1.4.0", + "universal-user-agent": "^2.0.0", + "url-template": "^2.0.8" + } + }, + "actions-toolkit": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/actions-toolkit/-/actions-toolkit-2.0.0.tgz", + "integrity": "sha512-wzQa0KkN0IUrJdl72hLV1a/oOAUpKLriETV5+/85T6sLfCaIJJQ3YUMtKDc1ctjfsdRfvYO8Qst8OOVi64boKw==", + "requires": { + "@octokit/graphql": "^2.0.1", + "@octokit/rest": "^16.15.0", + "enquirer": "^2.3.0", + "execa": "^1.0.0", + "flat-cache": "^2.0.1", + "js-yaml": "^3.13.0", + "minimist": "^1.2.0", + "signale": "^1.4.0" + } + }, + "ansi-colors": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.4.tgz", + "integrity": "sha512-hHUXGagefjN2iRrID63xckIvotOXOojhQKWIPUZ4mNUZ9nLZW+7FMNoE1lOkEhNWYsx/7ysGIuJYCiMAA9FnrA==" + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "requires": { + "color-convert": "^1.9.0" + } + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "atob-lite": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/atob-lite/-/atob-lite-2.0.0.tgz", + "integrity": "sha1-D+9a1G8b16hQLGVyfwNn1e5D1pY=" + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + }, + "before-after-hook": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-1.4.0.tgz", + "integrity": "sha512-l5r9ir56nda3qu14nAXIlyq1MmUSs0meCIaFAh8HwkFwP1F8eToOuS3ah2VAHHcY04jaYD7FpJC5JTXHYRbkzg==" + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "btoa-lite": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/btoa-lite/-/btoa-lite-1.0.0.tgz", + "integrity": "sha1-M3dm2hWAEhD92VbCLpxokaudAzc=" + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, + "deepmerge": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-3.2.0.tgz", + "integrity": "sha512-6+LuZGU7QCNUnAJyX8cIrlzoEgggTM6B7mm+znKOX4t5ltluT9KLjN6g61ECMS0LTsLW7yDpNoxhix5FZcrIow==" + }, + "deprecation": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-1.0.1.tgz", + "integrity": "sha512-ccVHpE72+tcIKaGMql33x5MAjKQIZrk+3x2GbJ7TeraUCZWHoT+KSZpoC+JQFsUBlSTXUrBaGiF0j6zVTepPLg==" + }, + "end-of-stream": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", + "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", + "requires": { + "once": "^1.4.0" + } + }, + "enquirer": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.0.tgz", + "integrity": "sha512-RNGUbRVlfnjmpxV+Ed+7CGu0rg3MK7MmlW+DW0v7V2zdAUBC1s4BxCRiIAozbYB2UJ+q4D+8tW9UFb11kF72/g==", + "requires": { + "ansi-colors": "^3.2.1" + } + }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "requires": { + "is-arrayish": "^0.2.1" + } + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" + }, + "execa": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", + "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", + "requires": { + "cross-spawn": "^6.0.0", + "get-stream": "^4.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "figures": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", + "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", + "requires": { + "escape-string-regexp": "^1.0.5" + } + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "requires": { + "locate-path": "^2.0.0" + } + }, + "flat-cache": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz", + "integrity": "sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA==", + "requires": { + "flatted": "^2.0.0", + "rimraf": "2.6.3", + "write": "1.0.3" + } + }, + "flatted": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.0.tgz", + "integrity": "sha512-R+H8IZclI8AAkSBRQJLVOsxwAoHd6WC40b4QTNWIjzAa6BXOBfQcM587MXDTVPeYaopFNWHUFLx7eNmHDSxMWg==" + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "requires": { + "pump": "^3.0.0" + } + }, + "glob": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", + "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "graceful-fs": { + "version": "4.1.15", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz", + "integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA==" + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=" + }, + "is-plain-object": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-3.0.0.tgz", + "integrity": "sha512-tZIpofR+P05k8Aocp7UI/2UTa9lTJSebCXpFFoR9aibpokDj/uXBsJ8luUu0tTVYKkMU6URDUuOfJZ7koewXvg==", + "requires": { + "isobject": "^4.0.0" + } + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=" + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" + }, + "isobject": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-4.0.0.tgz", + "integrity": "sha512-S/2fF5wH8SJA/kmwr6HYhK/RI/OkhD84k8ntalo0iJjZikgq1XFvR5M8NPT1x5F7fBwCG3qHfnzeP/Vh/ZxCUA==" + }, + "js-yaml": { + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==" + }, + "load-json-file": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" + } + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "requires": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + } + }, + "lodash.get": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", + "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=" + }, + "lodash.set": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/lodash.set/-/lodash.set-4.3.2.tgz", + "integrity": "sha1-2HV7HagH3eJIFrDWqEvqGnYjCyM=" + }, + "lodash.uniq": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", + "integrity": "sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=" + }, + "macos-release": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/macos-release/-/macos-release-2.2.0.tgz", + "integrity": "sha512-iV2IDxZaX8dIcM7fG6cI46uNmHUxHE4yN+Z8tKHAW1TBPMZDIKHf/3L+YnOuj/FK9il14UaVdHmiQ1tsi90ltA==" + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "requires": { + "minimist": "0.0.8" + }, + "dependencies": { + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" + } + } + }, + "nice-try": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==" + }, + "node-fetch": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.5.0.tgz", + "integrity": "sha512-YuZKluhWGJwCcUu4RlZstdAxr8bFfOVHakc1mplwHkk8J+tqM1Y5yraYvIUpeX8aY7+crCwiELJq7Vl0o0LWXw==" + }, + "npm-run-path": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "requires": { + "path-key": "^2.0.0" + } + }, + "octokit-pagination-methods": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/octokit-pagination-methods/-/octokit-pagination-methods-1.1.0.tgz", + "integrity": "sha512-fZ4qZdQ2nxJvtcasX7Ghl+WlWS/d9IgnBIwFZXVNNZUmzpno91SX5bc5vuxiuKoCtK78XxGGNuSCrDC7xYB3OQ==" + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "os-name": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/os-name/-/os-name-3.1.0.tgz", + "integrity": "sha512-h8L+8aNjNcMpo/mAIBPn5PXCM16iyPGjHNWo6U1YO8sJTMHtEtyczI6QJnLoplswm6goopQkqc7OAnjhWcugVg==", + "requires": { + "macos-release": "^2.2.0", + "windows-release": "^3.1.0" + } + }, + "p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=" + }, + "p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "requires": { + "p-try": "^1.0.0" + } + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "requires": { + "p-limit": "^1.1.0" + } + }, + "p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=" + }, + "parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", + "requires": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + } + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=" + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=" + }, + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=" + }, + "pkg-conf": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/pkg-conf/-/pkg-conf-2.1.0.tgz", + "integrity": "sha1-ISZRTKbyq/69FoWW3xi6V4Z/AFg=", + "requires": { + "find-up": "^2.0.0", + "load-json-file": "^4.0.0" + } + }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "rimraf": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "requires": { + "glob": "^7.1.3" + } + }, + "semver": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", + "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==" + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=" + }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" + }, + "signale": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/signale/-/signale-1.4.0.tgz", + "integrity": "sha512-iuh+gPf28RkltuJC7W5MRi6XAjTDCAPC/prJUpQoG4vIP3MJZ+GTydVnodXA7pwvTKb2cA0m9OFZW/cdWy/I/w==", + "requires": { + "chalk": "^2.3.2", + "figures": "^2.0.0", + "pkg-conf": "^2.1.0" + } + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=" + }, + "strip-eof": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=" + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "requires": { + "has-flag": "^3.0.0" + } + }, + "universal-user-agent": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-2.0.3.tgz", + "integrity": "sha512-eRHEHhChCBHrZsA4WEhdgiOKgdvgrMIHwnwnqD0r5C6AO8kwKcG7qSku3iXdhvHL3YvsS9ZkSGN8h/hIpoFC8g==", + "requires": { + "os-name": "^3.0.0" + } + }, + "url-template": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/url-template/-/url-template-2.0.8.tgz", + "integrity": "sha1-/FZaPMy/93MMd19WQflVV5FDnyE=" + }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "requires": { + "isexe": "^2.0.0" + } + }, + "windows-release": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/windows-release/-/windows-release-3.2.0.tgz", + "integrity": "sha512-QTlz2hKLrdqukrsapKsINzqMgOUpQW268eJ0OaOpJN32h272waxR9fkB9VoWRtK7uKHG5EHJcTXQBD8XZVJkFA==", + "requires": { + "execa": "^1.0.0" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "write": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/write/-/write-1.0.3.tgz", + "integrity": "sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig==", + "requires": { + "mkdirp": "^0.5.1" + } + } + } +} diff --git a/actions/auto-sprint/package.json b/actions/auto-sprint/package.json new file mode 100644 index 0000000000..302064812d --- /dev/null +++ b/actions/auto-sprint/package.json @@ -0,0 +1,11 @@ +{ + "name": "auto-sprint", + "private": true, + "main": "index.js", + "scripts": { + "start": "node ./index.js" + }, + "dependencies": { + "actions-toolkit": "^2.0.0" + } +} From 2a003e2f79736694657705f234f28bce75df3231 Mon Sep 17 00:00:00 2001 From: Ash Wilson Date: Wed, 8 May 2019 10:36:19 -0400 Subject: [PATCH 02/12] Action body :zap: --- actions/auto-sprint/index.js | 69 +++++++++++++++++++++++++++++++++--- 1 file changed, 65 insertions(+), 4 deletions(-) diff --git a/actions/auto-sprint/index.js b/actions/auto-sprint/index.js index 075f9b10dd..feffc144da 100644 --- a/actions/auto-sprint/index.js +++ b/actions/auto-sprint/index.js @@ -1,12 +1,73 @@ const {Toolkit} = require('actions-toolkit'); -Toolkit.run(tools => { - // Ensure that the actor of the triggering action is one of us +Toolkit.run(async tools => { + // Ensure that the actor of the triggering action belongs to the core team + const actorLogin = tools.context.actor; + const teamResponse = await tools.github.graphql(` + query { + organization(login: "atom") { + team(slug: "github-package") { + members(first: 100) { + nodes { + login + } + } + } + } + } + `); + if (!teamResponse.organization.team.members.nodes.some(node => node.login === actorLogin)) { + tools.exit.neutral('User %s is not in the github-package team. Thanks for your contribution!', actorLogin); + } - // Identify the active sprint board + // Identify the active release board and its "In progress" column + const projectQuery = await tools.github.graphql(` + query { + repository(owner: "atom", name: "github") { + projects( + search: "Release" + states: [OPEN] + first: 1 + orderBy: {field: CREATD_AT, direction: DESC} + ) { + nodes { + id + name + + columns(first: 10) { + nodes { + id + name + } + } + } + } + } + } + `); + const project = projectQuery.repository.projects.nodes[0]; + if (!project) { + tools.exit.failure('No open project found with a name matching "Release".'); + } + const column = project.columns.nodes.find(node => node.name === 'In progress'); + if (!column) { + tools.exit.failure('No column found in the project %s with a name of exactly "In progress".', project.name); + } // Add the issue/pull request to the sprint board - tools.exit.success('We did it!'); + await tools.github.graphql(` + mutation ProjectCardAddition($columnID: ID!, contentID: ID!) { + addProjectCard(input: {projectColumnId: $columnID, contentID: $issueishID}) { + clientMutationId + } + } + `, { + columnID: column.id, + contentID: tools.context.event === 'issues' + ? tools.context.payload.issue.node_id + : tools.context.payload.pull_request.node_id, + }); + tools.exit.success('Added as a project card.'); }, { event: ['issues.assigned', 'pull_request.opened'], secrets: ['GITHUB_TOKEN'], From a0212d38c52455c51b18e91b8e2f85eca2a8fc05 Mon Sep 17 00:00:00 2001 From: Ash Wilson Date: Wed, 8 May 2019 10:45:49 -0400 Subject: [PATCH 03/12] Workflow configuration --- .github/main.workflow | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/main.workflow b/.github/main.workflow index e62af80adf..97282f36d7 100644 --- a/.github/main.workflow +++ b/.github/main.workflow @@ -4,7 +4,22 @@ workflow "GraphQL schema update" { resolves = "Update schema" } +workflow "Add assigned issue to release board" { + on = "issues" + resolves = "Add to release board" +} + +workflow "Add PR to release board" { + on = "pull_request" + resolves = "Add to release board" +} + action "Update schema" { uses = "./actions/schema-up" secrets = ["GITHUB_TOKEN"] } + +action "Add to release board" { + uses = "./actions/auto-sprint" + secrets = ["GITHUB_TOKEN"] +} From 16dee86fceaf8b0422a7f36b9fe4b2dd5598d1f8 Mon Sep 17 00:00:00 2001 From: Ash Wilson Date: Wed, 8 May 2019 10:57:21 -0400 Subject: [PATCH 04/12] Operate on pull requests that are opened, assigned, or merged --- actions/auto-sprint/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actions/auto-sprint/index.js b/actions/auto-sprint/index.js index feffc144da..cb119f775c 100644 --- a/actions/auto-sprint/index.js +++ b/actions/auto-sprint/index.js @@ -69,6 +69,6 @@ Toolkit.run(async tools => { }); tools.exit.success('Added as a project card.'); }, { - event: ['issues.assigned', 'pull_request.opened'], + event: ['issues.assigned', 'pull_request.opened', 'pull_request.merged', 'pull_request.assigned'], secrets: ['GITHUB_TOKEN'], }); From 5a1de3371d21ef10bd542b23764fcc9725a19b80 Mon Sep 17 00:00:00 2001 From: Ash Wilson Date: Wed, 8 May 2019 10:57:40 -0400 Subject: [PATCH 05/12] Filter based on action before our workflow --- .github/main.workflow | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/.github/main.workflow b/.github/main.workflow index 97282f36d7..5bfc490188 100644 --- a/.github/main.workflow +++ b/.github/main.workflow @@ -4,14 +4,14 @@ workflow "GraphQL schema update" { resolves = "Update schema" } -workflow "Add assigned issue to release board" { +workflow "Add issue to release board" { on = "issues" - resolves = "Add to release board" + resolves = "Add issue to release board" } workflow "Add PR to release board" { on = "pull_request" - resolves = "Add to release board" + resolves = "Add pull request to release board" } action "Update schema" { @@ -19,7 +19,24 @@ action "Update schema" { secrets = ["GITHUB_TOKEN"] } -action "Add to release board" { +action "Issue assigned" { + uses = "actions/bin/filter@master" + args = "action assigned" +} + +action "Add issue to release board" { + needs = "Issue assigned" + uses = "./actions/auto-sprint" + secrets = ["GITHUB_TOKEN"] +} + +action "Pull request opened, merged, or assigned" { + uses = "actions/bin/filter@master" + args = "action 'opened|merged|assigned'" +} + +action "Add pull request to release board" { + needs = "Pull request opened, merged, or assigned" uses = "./actions/auto-sprint" secrets = ["GITHUB_TOKEN"] } From 8e09d3a987696945f2777cd129a1481488dadf3b Mon Sep 17 00:00:00 2001 From: Ash Wilson Date: Wed, 8 May 2019 11:00:28 -0400 Subject: [PATCH 06/12] Rename workflows to avoid a collision --- .github/main.workflow | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/main.workflow b/.github/main.workflow index 5bfc490188..64353f1995 100644 --- a/.github/main.workflow +++ b/.github/main.workflow @@ -4,12 +4,12 @@ workflow "GraphQL schema update" { resolves = "Update schema" } -workflow "Add issue to release board" { +workflow "Core team issues" { on = "issues" resolves = "Add issue to release board" } -workflow "Add PR to release board" { +workflow "Core team pull requests" { on = "pull_request" resolves = "Add pull request to release board" } From 4b0c551854fb91deb63e8850fc81890e36d0316f Mon Sep 17 00:00:00 2001 From: Ash Wilson Date: Wed, 8 May 2019 11:19:34 -0400 Subject: [PATCH 07/12] Use a PAT with more scopes --- actions/auto-sprint/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/actions/auto-sprint/index.js b/actions/auto-sprint/index.js index cb119f775c..e274d246c8 100644 --- a/actions/auto-sprint/index.js +++ b/actions/auto-sprint/index.js @@ -1,6 +1,10 @@ const {Toolkit} = require('actions-toolkit'); +const {withDefaults} = require('actions-toolkit/graphql'); Toolkit.run(async tools => { + // Re-authenticate with the correct secret. + tools.github.graphql = withDefaults(process.env.GRAPHQL_TOKEN); + // Ensure that the actor of the triggering action belongs to the core team const actorLogin = tools.context.actor; const teamResponse = await tools.github.graphql(` @@ -70,5 +74,5 @@ Toolkit.run(async tools => { tools.exit.success('Added as a project card.'); }, { event: ['issues.assigned', 'pull_request.opened', 'pull_request.merged', 'pull_request.assigned'], - secrets: ['GITHUB_TOKEN'], + secrets: ['GRAPHQL_TOKEN'], }); From 272514b466186152212403de19672f3a883e5bc3 Mon Sep 17 00:00:00 2001 From: Ash Wilson Date: Wed, 8 May 2019 11:19:44 -0400 Subject: [PATCH 08/12] Typo fix --- actions/auto-sprint/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actions/auto-sprint/index.js b/actions/auto-sprint/index.js index e274d246c8..95c9a058b8 100644 --- a/actions/auto-sprint/index.js +++ b/actions/auto-sprint/index.js @@ -32,7 +32,7 @@ Toolkit.run(async tools => { search: "Release" states: [OPEN] first: 1 - orderBy: {field: CREATD_AT, direction: DESC} + orderBy: {field: CREATED_AT, direction: DESC} ) { nodes { id From b079b752bfd570d6e7802b19c13bab6759ccb9ab Mon Sep 17 00:00:00 2001 From: Ash Wilson Date: Wed, 8 May 2019 11:24:21 -0400 Subject: [PATCH 09/12] Fire on pull request reopen --- .github/main.workflow | 10 +++++----- actions/auto-sprint/index.js | 8 +++++++- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/main.workflow b/.github/main.workflow index 64353f1995..41fd00a71b 100644 --- a/.github/main.workflow +++ b/.github/main.workflow @@ -19,24 +19,24 @@ action "Update schema" { secrets = ["GITHUB_TOKEN"] } -action "Issue assigned" { +action "Consider issue for release board" { uses = "actions/bin/filter@master" args = "action assigned" } action "Add issue to release board" { - needs = "Issue assigned" + needs = "Consider issue for release board" uses = "./actions/auto-sprint" secrets = ["GITHUB_TOKEN"] } -action "Pull request opened, merged, or assigned" { +action "Consider pull request for release board" { uses = "actions/bin/filter@master" - args = "action 'opened|merged|assigned'" + args = "action 'opened|merged|assigned|reopened'" } action "Add pull request to release board" { - needs = "Pull request opened, merged, or assigned" + needs = "Consider pull request for release board" uses = "./actions/auto-sprint" secrets = ["GITHUB_TOKEN"] } diff --git a/actions/auto-sprint/index.js b/actions/auto-sprint/index.js index 95c9a058b8..870f7bb4bc 100644 --- a/actions/auto-sprint/index.js +++ b/actions/auto-sprint/index.js @@ -73,6 +73,12 @@ Toolkit.run(async tools => { }); tools.exit.success('Added as a project card.'); }, { - event: ['issues.assigned', 'pull_request.opened', 'pull_request.merged', 'pull_request.assigned'], + event: [ + 'issues.assigned', + 'pull_request.opened', + 'pull_request.merged', + 'pull_request.assigned', + 'pull_request.reopened', + ], secrets: ['GRAPHQL_TOKEN'], }); From 9834f7bb8a328882eea6522abaf3e85fc5dcea55 Mon Sep 17 00:00:00 2001 From: Ash Wilson Date: Wed, 8 May 2019 11:27:16 -0400 Subject: [PATCH 10/12] Fix the import --- actions/auto-sprint/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actions/auto-sprint/index.js b/actions/auto-sprint/index.js index 870f7bb4bc..d1dc2a2f31 100644 --- a/actions/auto-sprint/index.js +++ b/actions/auto-sprint/index.js @@ -1,5 +1,5 @@ const {Toolkit} = require('actions-toolkit'); -const {withDefaults} = require('actions-toolkit/graphql'); +const {withDefaults} = require('actions-toolkit/lib/graphql'); Toolkit.run(async tools => { // Re-authenticate with the correct secret. From 3da23b5bcac7f215ddfb6b1813fd1b0686c23713 Mon Sep 17 00:00:00 2001 From: Ash Wilson Date: Wed, 8 May 2019 11:31:24 -0400 Subject: [PATCH 11/12] Pass the right secret --- .github/main.workflow | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/main.workflow b/.github/main.workflow index 41fd00a71b..d0db0be3a3 100644 --- a/.github/main.workflow +++ b/.github/main.workflow @@ -38,5 +38,5 @@ action "Consider pull request for release board" { action "Add pull request to release board" { needs = "Consider pull request for release board" uses = "./actions/auto-sprint" - secrets = ["GITHUB_TOKEN"] + secrets = ["GRAPHQL_TOKEN"] } From 38e6200db93a8f694341d9dce657a39835f8bf57 Mon Sep 17 00:00:00 2001 From: Ash Wilson Date: Wed, 8 May 2019 12:27:02 -0400 Subject: [PATCH 12/12] Some GraphQL typos --- actions/auto-sprint/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/actions/auto-sprint/index.js b/actions/auto-sprint/index.js index d1dc2a2f31..374a1437cd 100644 --- a/actions/auto-sprint/index.js +++ b/actions/auto-sprint/index.js @@ -60,14 +60,14 @@ Toolkit.run(async tools => { // Add the issue/pull request to the sprint board await tools.github.graphql(` - mutation ProjectCardAddition($columnID: ID!, contentID: ID!) { - addProjectCard(input: {projectColumnId: $columnID, contentID: $issueishID}) { + mutation ProjectCardAddition($columnID: ID!, $issueishID: ID!) { + addProjectCard(input: {projectColumnId: $columnID, contentId: $issueishID}) { clientMutationId } } `, { columnID: column.id, - contentID: tools.context.event === 'issues' + issueishID: tools.context.event === 'issues' ? tools.context.payload.issue.node_id : tools.context.payload.pull_request.node_id, });