|
61 | 61 |
|
62 | 62 | [More details of target event](#action-event-details)
|
63 | 63 |
|
| 64 | +## CLI Tool |
| 65 | +[](https://github.com/technote-space/release-github-actions-cli) |
| 66 | +
|
64 | 67 | ## Screenshots
|
65 | 68 | 1. Before publish release
|
66 | 69 | 
|
|
91 | 94 | | ORIGINAL_TAG_PREFIX | Prefix to add when leaving the original tag | | | `original/` |
|
92 | 95 | | GITHUB_TOKEN | Access token | `${{github.token}}` | true | `${{secrets.ACCESS_TOKEN}}` |
|
93 | 96 |
|
94 |
| -## CLI Tool |
95 |
| -[](https://github.com/technote-space/release-github-actions-cli) |
96 |
| - |
97 | 97 | ## Execute commands
|
98 | 98 | ### Build
|
99 | 99 | - If package.json includes `build`, `production`, `prod` or `package` in scripts, the command is used for build. (You can change this with [BUILD_COMMAND_TARGET](#build_command_target))
|
@@ -132,6 +132,73 @@ The default setting assumes the use of `Action template for TypeScript` or `Acti
|
132 | 132 | https://github.com/actions/typescript-action
|
133 | 133 | https://github.com/actions/javascript-action
|
134 | 134 |
|
| 135 | +However, these templates have security issues etc, you must do the following. |
| 136 | + |
| 137 | +#### Action template for JavaScript |
| 138 | + |
| 139 | +If a pull request includes a built file, it is highly likely that even malicious code will be missed in a review, so you need to fix `.gitignore` as follows: |
| 140 | + |
| 141 | +`.gitignore` |
| 142 | +```diff |
| 143 | ++ /dist |
| 144 | +``` |
| 145 | + |
| 146 | +#### Action template for TypeScript |
| 147 | + |
| 148 | +Since processing by `ncc` is unnecessary, delete the related commands and packages and modify `action.yml` to use script built with `tsc`. |
| 149 | + |
| 150 | +`action.yml` |
| 151 | +```diff |
| 152 | + name: 'Your name here' |
| 153 | + description: 'Provide a description here' |
| 154 | + author: 'Your name or organization here' |
| 155 | + inputs: |
| 156 | + myInput: # change this |
| 157 | + description: 'input description here' |
| 158 | + default: 'default value if applicable' |
| 159 | + runs: |
| 160 | + using: 'node12' |
| 161 | +- main: 'dist/index.js' |
| 162 | ++ main: 'lib/main.js' |
| 163 | +``` |
| 164 | + |
| 165 | +`package.json` |
| 166 | +```diff |
| 167 | + "scripts": { |
| 168 | + "build": "tsc", |
| 169 | + "format": "prettier --write **/*.ts", |
| 170 | + "format-check": "prettier --check **/*.ts", |
| 171 | + "lint": "eslint src/**/*.ts", |
| 172 | +- "pack": "ncc build", |
| 173 | +- "test": "jest", |
| 174 | +- "all": "npm run build && npm run format && npm run lint && npm run pack && npm test" |
| 175 | ++ "test": "jest" |
| 176 | + }, |
| 177 | +``` |
| 178 | + |
| 179 | +```diff |
| 180 | + "devDependencies": { |
| 181 | + "@types/jest": "^24.0.23", |
| 182 | + "@types/node": "^12.7.12", |
| 183 | + "@typescript-eslint/parser": "^2.8.0", |
| 184 | +- "@zeit/ncc": "^0.20.5", |
| 185 | + "eslint": "^5.16.0", |
| 186 | + "eslint-plugin-github": "^2.0.0", |
| 187 | + "eslint-plugin-jest": "^22.21.0", |
| 188 | + "jest": "^24.9.0", |
| 189 | + "jest-circus": "^24.9.0", |
| 190 | + "js-yaml": "^3.13.1", |
| 191 | + "prettier": "^1.19.1", |
| 192 | + "ts-jest": "^24.2.0", |
| 193 | + "typescript": "^3.6.4" |
| 194 | + } |
| 195 | +``` |
| 196 | + |
| 197 | +Or use the template I created. |
| 198 | + |
| 199 | +[](https://github.com/technote-space/gh-actions-template) |
| 200 | + |
| 201 | + |
135 | 202 | You can see an example of `GitHub Actions` with unnecessary files deleted below.
|
136 | 203 | https://github.com/technote-space/release-github-actions/tree/gh-actions
|
137 | 204 |
|
|
0 commit comments