|
39 | 39 | secrets: |
40 | 40 | github-token: |
41 | 41 | description: | |
42 | | - GitHub token with permissions `contents: write`, `pull-requests: write`. |
| 42 | + GitHub token with following permissions: |
| 43 | +
|
| 44 | + - `contents: write` |
| 45 | + - `pull-requests: write` |
43 | 46 | github-app-key: |
44 | 47 | description: | |
45 | 48 | GitHub App private key to generate GitHub token in place of github-token. |
@@ -101,7 +104,7 @@ jobs: |
101 | 104 | const configPath = process.env.CONFIG_PATH; |
102 | 105 | if (!configPath){ |
103 | 106 | return core.setFailed('Configuration path is not specified.'); |
104 | | - } |
| 107 | + } |
105 | 108 | if (!fs.existsSync(configPath)) { |
106 | 109 | return core.warning(`Release configuration file "${configPath}" does not exist.`); |
107 | 110 | } |
@@ -137,7 +140,7 @@ jobs: |
137 | 140 | if: github.event_name == 'push' && github.ref_name == github.event.repository.default_branch |
138 | 141 | runs-on: ${{ fromJson(inputs.runs-on) }} |
139 | 142 | permissions: |
140 | | - contents: read |
| 143 | + contents: write |
141 | 144 | pull-requests: write |
142 | 145 | env: |
143 | 146 | INCLUDE_PATHS: ${{ inputs.include-paths }} |
@@ -190,7 +193,7 @@ jobs: |
190 | 193 | } |
191 | 194 | } |
192 | 195 |
|
193 | | - // Build include-paths section if includePaths is not empty |
| 196 | + // Build include-paths section if includePaths is not empty |
194 | 197 | let includePathsSection = ''; |
195 | 198 | if (includePaths.size > 0 ) { |
196 | 199 | const pathsYaml = Array.from(includePaths).map(p => ` - "${p}"`).join('\n'); |
@@ -280,24 +283,24 @@ jobs: |
280 | 283 | script: | |
281 | 284 | const fs = require('node:fs'); |
282 | 285 | const path = require('node:path'); |
| 286 | +
|
283 | 287 | const configContent = process.env.CONFIG_CONTENT; |
284 | 288 | const configPath = process.env.CONFIG_PATH; |
285 | 289 | const configDir = path.dirname(configPath); |
| 290 | +
|
286 | 291 | fs.mkdirSync(configDir, { recursive: true }); |
287 | 292 | fs.writeFileSync(configPath, configContent, 'utf8'); |
288 | 293 |
|
289 | | - core.setOutput('branch', `ci/prepare-release-config${ |
290 | | - process.env.CONFIG_SLUG ? `/${process.env.CONFIG_SLUG}` : '' |
291 | | - }`); |
292 | | - core.setOutput('title', `ci: prepare release configuration${ |
293 | | - process.env.CONFIG_SLUG ? ` for "${process.env.CONFIG_SLUG}"` : '' |
294 | | - }`); |
295 | | - core.setOutput('body', `Prepare release configuration${ |
296 | | - process.env.WORKING_DIRECTORY ? ` for "${process.env.WORKING_DIRECTORY}" working directory` : '' |
297 | | - }.`); |
298 | | - core.setOutput('commit-message', `ci: prepare release configuration${ |
299 | | - process.env.CONFIG_SLUG ? ` for "${process.env.CONFIG_SLUG}"` : '' |
300 | | - }\n\n[skip ci]`); |
| 294 | + const outputs = { |
| 295 | + branch: `ci/prepare-release-config${process.env.CONFIG_SLUG ? `/${process.env.CONFIG_SLUG}` : ''}`, |
| 296 | + title: `ci: prepare release configuration${process.env.CONFIG_SLUG ? ` for "${process.env.CONFIG_SLUG}"` : ''}`, |
| 297 | + body: `Prepare release configuration${process.env.WORKING_DIRECTORY ? ` for "${process.env.WORKING_DIRECTORY}" working directory` : ''}.`, |
| 298 | + "commit-message": `ci: prepare release configuration${process.env.CONFIG_SLUG ? ` for "${process.env.CONFIG_SLUG}"` : ''}\n\n[skip ci]`, |
| 299 | + }; |
| 300 | +
|
| 301 | + for (const [key, value] of Object.entries(outputs)) { |
| 302 | + core.setOutput(key, value); |
| 303 | + } |
301 | 304 |
|
302 | 305 | - uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1 |
303 | 306 | if: ${{ steps.get-config.outputs.config-content && inputs.github-app-id }} |
|
0 commit comments