[READ-ONLY] Mirror of https://github.com/probablykasper/readme-template-action. Integrate GitHub API data in your README.md
0

Configure Feed

Select the types of activity you want to include in your feed.

feat: access name of repo where actions is running

Humberto Linero (Jul 2, 2021, 5:18 PM +0200) 5c3863d6 da79bbd3

+245 -1
+9
dist/index.js
··· 11549 11549 const ghToken = core.getInput('TOKEN', { required: true }); 11550 11550 core.setSecret(ghToken); 11551 11551 const octokit = github.getOctokit(ghToken); 11552 + function getCurrentRepoFullName() { 11553 + const currentRepoFullName = process.env.GITHUB_REPOSITORY; 11554 + return { 'CURRENT_REPO_FULL_NAME': currentRepoFullName }; 11555 + } 11552 11556 async function getUser() { 11553 11557 const queryResult = await octokit.graphql(` 11554 11558 query { ··· 11811 11815 const user = await getUser(); 11812 11816 console.log(' - Injecting'); 11813 11817 outputStr = inject(outputStr, user); 11818 + console.log('Current repository name'); 11819 + console.log(' - Fetching'); 11820 + const currentRepo = getCurrentRepoFullName(); 11821 + console.log(' - Injecting'); 11822 + outputStr = inject(outputStr, currentRepo); 11814 11823 if (!customTemplate['3_MOST_STARRED_REPOS']) { 11815 11824 customTemplate['3_MOST_STARRED_REPOS'] = { 11816 11825 type: 'repos',
+225 -1
package-lock.json
··· 1 1 { 2 2 "name": "readme-template", 3 + "lockfileVersion": 2, 3 4 "requires": true, 4 - "lockfileVersion": 1, 5 + "packages": { 6 + "": { 7 + "name": "readme-template", 8 + "dependencies": { 9 + "@actions/core": "^1.2.6", 10 + "@actions/github": "^4.0.0", 11 + "@vercel/ncc": "^0.28.0", 12 + "moment": "^2.29.1", 13 + "require-from-string": "^2.0.2" 14 + }, 15 + "devDependencies": { 16 + "typescript": "^4.2.3" 17 + } 18 + }, 19 + "node_modules/@actions/core": { 20 + "version": "1.2.6", 21 + "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.6.tgz", 22 + "integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA==" 23 + }, 24 + "node_modules/@actions/github": { 25 + "version": "4.0.0", 26 + "resolved": "https://registry.npmjs.org/@actions/github/-/github-4.0.0.tgz", 27 + "integrity": "sha512-Ej/Y2E+VV6sR9X7pWL5F3VgEWrABaT292DRqRU6R4hnQjPtC/zD3nagxVdXWiRQvYDh8kHXo7IDmG42eJ/dOMA==", 28 + "dependencies": { 29 + "@actions/http-client": "^1.0.8", 30 + "@octokit/core": "^3.0.0", 31 + "@octokit/plugin-paginate-rest": "^2.2.3", 32 + "@octokit/plugin-rest-endpoint-methods": "^4.0.0" 33 + } 34 + }, 35 + "node_modules/@actions/http-client": { 36 + "version": "1.0.8", 37 + "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.8.tgz", 38 + "integrity": "sha512-G4JjJ6f9Hb3Zvejj+ewLLKLf99ZC+9v+yCxoYf9vSyH+WkzPLB2LuUtRMGNkooMqdugGBFStIKXOuvH1W+EctA==", 39 + "dependencies": { 40 + "tunnel": "0.0.6" 41 + } 42 + }, 43 + "node_modules/@octokit/auth-token": { 44 + "version": "2.4.2", 45 + "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.4.2.tgz", 46 + "integrity": "sha512-jE/lE/IKIz2v1+/P0u4fJqv0kYwXOTujKemJMFr6FeopsxlIK3+wKDCJGnysg81XID5TgZQbIfuJ5J0lnTiuyQ==", 47 + "dependencies": { 48 + "@octokit/types": "^5.0.0" 49 + } 50 + }, 51 + "node_modules/@octokit/core": { 52 + "version": "3.1.2", 53 + "resolved": "https://registry.npmjs.org/@octokit/core/-/core-3.1.2.tgz", 54 + "integrity": "sha512-AInOFULmwOa7+NFi9F8DlDkm5qtZVmDQayi7TUgChE3yeIGPq0Y+6cAEXPexQ3Ea+uZy66hKEazR7DJyU+4wfw==", 55 + "dependencies": { 56 + "@octokit/auth-token": "^2.4.0", 57 + "@octokit/graphql": "^4.3.1", 58 + "@octokit/request": "^5.4.0", 59 + "@octokit/types": "^5.0.0", 60 + "before-after-hook": "^2.1.0", 61 + "universal-user-agent": "^6.0.0" 62 + } 63 + }, 64 + "node_modules/@octokit/endpoint": { 65 + "version": "6.0.5", 66 + "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.5.tgz", 67 + "integrity": "sha512-70K5u6zd45ItOny6aHQAsea8HHQjlQq85yqOMe+Aj8dkhN2qSJ9T+Q3YjUjEYfPRBcuUWNgMn62DQnP/4LAIiQ==", 68 + "dependencies": { 69 + "@octokit/types": "^5.0.0", 70 + "is-plain-object": "^4.0.0", 71 + "universal-user-agent": "^6.0.0" 72 + } 73 + }, 74 + "node_modules/@octokit/graphql": { 75 + "version": "4.5.4", 76 + "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.5.4.tgz", 77 + "integrity": "sha512-ITpZ+dQc0cXAW1FmDkHJJM+8Lb6anUnin0VB5hLBilnYVdLC0ICFU/KIvT7OXfW9S81DE3U4Vx2EypDG1OYaPA==", 78 + "dependencies": { 79 + "@octokit/request": "^5.3.0", 80 + "@octokit/types": "^5.0.0", 81 + "universal-user-agent": "^6.0.0" 82 + } 83 + }, 84 + "node_modules/@octokit/plugin-paginate-rest": { 85 + "version": "2.3.0", 86 + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.3.0.tgz", 87 + "integrity": "sha512-Ye2ZJreP0ZlqJQz8fz+hXvrEAEYK4ay7br1eDpWzr6j76VXs/gKqxFcH8qRzkB3fo/2xh4Vy9VtGii4ZDc9qlA==", 88 + "dependencies": { 89 + "@octokit/types": "^5.2.0" 90 + } 91 + }, 92 + "node_modules/@octokit/plugin-rest-endpoint-methods": { 93 + "version": "4.1.2", 94 + "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-4.1.2.tgz", 95 + "integrity": "sha512-PTI7wpbGEZ2IR87TVh+TNWaLcgX/RsZQalFbQCq8XxYUrQ36RHyERrHSNXFy5gkWpspUAOYRSV707JJv6BhqJA==", 96 + "dependencies": { 97 + "@octokit/types": "^5.1.1", 98 + "deprecation": "^2.3.1" 99 + } 100 + }, 101 + "node_modules/@octokit/request": { 102 + "version": "5.4.7", 103 + "resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.4.7.tgz", 104 + "integrity": "sha512-FN22xUDP0i0uF38YMbOfx6TotpcENP5W8yJM1e/LieGXn6IoRxDMnBf7tx5RKSW4xuUZ/1P04NFZy5iY3Rax1A==", 105 + "dependencies": { 106 + "@octokit/endpoint": "^6.0.1", 107 + "@octokit/request-error": "^2.0.0", 108 + "@octokit/types": "^5.0.0", 109 + "deprecation": "^2.0.0", 110 + "is-plain-object": "^4.0.0", 111 + "node-fetch": "^2.3.0", 112 + "once": "^1.4.0", 113 + "universal-user-agent": "^6.0.0" 114 + } 115 + }, 116 + "node_modules/@octokit/request-error": { 117 + "version": "2.0.2", 118 + "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-2.0.2.tgz", 119 + "integrity": "sha512-2BrmnvVSV1MXQvEkrb9zwzP0wXFNbPJij922kYBTLIlIafukrGOb+ABBT2+c6wZiuyWDH1K1zmjGQ0toN/wMWw==", 120 + "dependencies": { 121 + "@octokit/types": "^5.0.1", 122 + "deprecation": "^2.0.0", 123 + "once": "^1.4.0" 124 + } 125 + }, 126 + "node_modules/@octokit/types": { 127 + "version": "5.4.1", 128 + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-5.4.1.tgz", 129 + "integrity": "sha512-OlMlSySBJoJ6uozkr/i03nO5dlYQyE05vmQNZhAh9MyO4DPBP88QlwsDVLmVjIMFssvIZB6WO0ctIGMRG+xsJQ==", 130 + "dependencies": { 131 + "@types/node": ">= 8" 132 + } 133 + }, 134 + "node_modules/@types/node": { 135 + "version": "14.6.0", 136 + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.6.0.tgz", 137 + "integrity": "sha512-mikldZQitV94akrc4sCcSjtJfsTKt4p+e/s0AGscVA6XArQ9kFclP+ZiYUMnq987rc6QlYxXv/EivqlfSLxpKA==" 138 + }, 139 + "node_modules/@vercel/ncc": { 140 + "version": "0.28.0", 141 + "resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.28.0.tgz", 142 + "integrity": "sha512-dKFgT0r61LmKcMsriSkoxOSp+A45ADRFxrYXvFMmuLEpvc2a+fBAIh8Pg1Q7RYtPTZE1kX/Tk+nmOpNGyb5P2w==", 143 + "bin": { 144 + "ncc": "dist/ncc/cli.js" 145 + } 146 + }, 147 + "node_modules/before-after-hook": { 148 + "version": "2.1.0", 149 + "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.1.0.tgz", 150 + "integrity": "sha512-IWIbu7pMqyw3EAJHzzHbWa85b6oud/yfKYg5rqB5hNE8CeMi3nX+2C2sj0HswfblST86hpVEOAb9x34NZd6P7A==" 151 + }, 152 + "node_modules/deprecation": { 153 + "version": "2.3.1", 154 + "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", 155 + "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==" 156 + }, 157 + "node_modules/is-plain-object": { 158 + "version": "4.1.1", 159 + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-4.1.1.tgz", 160 + "integrity": "sha512-5Aw8LLVsDlZsETVMhoMXzqsXwQqr/0vlnBYzIXJbYo2F4yYlhLHs+Ez7Bod7IIQKWkJbJfxrWD7pA1Dw1TKrwA==", 161 + "engines": { 162 + "node": ">=0.10.0" 163 + } 164 + }, 165 + "node_modules/moment": { 166 + "version": "2.29.1", 167 + "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz", 168 + "integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==", 169 + "engines": { 170 + "node": "*" 171 + } 172 + }, 173 + "node_modules/node-fetch": { 174 + "version": "2.6.0", 175 + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", 176 + "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==", 177 + "engines": { 178 + "node": "4.x || >=6.0.0" 179 + } 180 + }, 181 + "node_modules/once": { 182 + "version": "1.4.0", 183 + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", 184 + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", 185 + "dependencies": { 186 + "wrappy": "1" 187 + } 188 + }, 189 + "node_modules/require-from-string": { 190 + "version": "2.0.2", 191 + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", 192 + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", 193 + "engines": { 194 + "node": ">=0.10.0" 195 + } 196 + }, 197 + "node_modules/tunnel": { 198 + "version": "0.0.6", 199 + "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", 200 + "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==", 201 + "engines": { 202 + "node": ">=0.6.11 <=0.7.0 || >=0.7.3" 203 + } 204 + }, 205 + "node_modules/typescript": { 206 + "version": "4.2.3", 207 + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.3.tgz", 208 + "integrity": "sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw==", 209 + "dev": true, 210 + "bin": { 211 + "tsc": "bin/tsc", 212 + "tsserver": "bin/tsserver" 213 + }, 214 + "engines": { 215 + "node": ">=4.2.0" 216 + } 217 + }, 218 + "node_modules/universal-user-agent": { 219 + "version": "6.0.0", 220 + "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.0.tgz", 221 + "integrity": "sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w==" 222 + }, 223 + "node_modules/wrappy": { 224 + "version": "1.0.2", 225 + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", 226 + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" 227 + } 228 + }, 5 229 "dependencies": { 6 230 "@actions/core": { 7 231 "version": "1.2.6",
+6
src/main.ts
··· 95 95 console.log(' - Injecting') 96 96 outputStr = inject(outputStr, user) 97 97 98 + console.log('Current repository name') 99 + console.log(' - Fetching') 100 + const currentRepo = queries.getCurrentRepoFullName() 101 + console.log(' - Injecting') 102 + outputStr = inject(outputStr, currentRepo) 103 + 98 104 if (!customTemplate['3_MOST_STARRED_REPOS']) { 99 105 customTemplate['3_MOST_STARRED_REPOS'] = { 100 106 type: 'repos',
+5
src/queries.ts
··· 6 6 core.setSecret(ghToken) 7 7 export const octokit = github.getOctokit(ghToken) 8 8 9 + export function getCurrentRepoFullName() { 10 + const currentRepoFullName = process.env.GITHUB_REPOSITORY 11 + return {'CURRENT_REPO_FULL_NAME': currentRepoFullName} 12 + } 13 + 9 14 export async function getUser() { 10 15 const queryResult: any = await octokit.graphql(` 11 16 query {