@@ -53,6 +53,10 @@ inputs:
5353 description : |
5454 GitHub token for coverage PR comments.
5555 Required when coverage is set to `github`.
56+ Requires permissions to create and update PR comments:
57+
58+ - `issues: write`
59+ - `pull-requests: write`
5660 required : false
5761 default : " "
5862
@@ -140,39 +144,36 @@ runs:
140144
141145 # Check and install dependencies for codecov in container mode
142146 - name : Check and install Codecov dependencies
143- if : inputs.coverage == 'codecov' && inputs.container == 'true'
147+ if : always() && inputs.coverage == 'codecov' && inputs.container == 'true'
144148 id : check-codecov-deps
145149 uses : actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
146150 with :
147151 script : |
148- const path = require('node:path');
149-
150152 // Check which dependencies are missing
151- const deps = [' git', ' curl', ' gpg'] ;
153+ const deps = {" git": "git", " curl": "curl", " gpg": "gnupg.org"} ;
152154 const missingDeps = [];
153155
154- for (const dep of deps) {
156+ for (const [ dep, pkg] of Object.entries( deps) ) {
155157 try {
156158 await io.which(dep, true);
157- core.info(`✓ ${dep} is already available`);
158159 } catch {
159- core.info(`✗ ${dep} is not available, will be installed`);
160- missingDeps.push(dep);
160+ missingDeps.push(pkg);
161161 }
162162 }
163163
164- core.setOutput('missing-deps', missingDeps.join(' '));
165- core.setOutput('needs-install', missingDeps.length > 0 ? 'true' : 'false');
164+ if (missingDeps.length > 0) {
165+ core.setOutput('missing-deps', missingDeps.join(' '));
166+ }
166167
167168 - name : Install missing Codecov dependencies
168- if : inputs.coverage == 'codecov' && inputs.container == 'true' && steps.check-codecov-deps.outputs.needs-install == 'true'
169+ if : always() && steps.check-codecov-deps.outputs.missing-deps
169170 uses : pkgxdev/setup@f211ee4db3110b42e5a156282372527e7c1ed723 # v4.0.0
170171 with :
171- + : git curl gnupg.org
172+ + : ${{ steps.check-codecov-deps.outputs.missing-deps }}
172173
173174 # Fix pkgxdev gnupg's gpgconf.ctl which contains unexpanded environment variables
174175 - name : Fix GPG configuration
175- if : inputs.coverage == 'codecov' && inputs.container == 'true'
176+ if : always() && contains(steps.check-codecov-deps.outputs.missing-deps, 'gnupg.org')
176177 uses : actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
177178 with :
178179 script : |
0 commit comments