@@ -140,39 +140,36 @@ runs:
140140
141141 # Check and install dependencies for codecov in container mode
142142 - name : Check and install Codecov dependencies
143- if : inputs.coverage == 'codecov' && inputs.container == 'true'
143+ if : always() && inputs.coverage == 'codecov' && inputs.container == 'true'
144144 id : check-codecov-deps
145145 uses : actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
146146 with :
147147 script : |
148- const path = require('node:path');
149-
150148 // Check which dependencies are missing
151- const deps = [' git', ' curl', ' gpg'] ;
149+ const deps = {" git": "git", " curl": "curl", " gpg": "gnupg.org"} ;
152150 const missingDeps = [];
153151
154- for (const dep of deps) {
152+ for (const [ dep, pkg] of Object.entries( deps) {
155153 try {
156154 await io.which(dep, true);
157- core.info(`✓ ${dep} is already available`);
158155 } catch {
159- core.info(`✗ ${dep} is not available, will be installed`);
160- missingDeps.push(dep);
156+ missingDeps.push(pkg);
161157 }
162158 }
163159
164- core.setOutput('missing-deps', missingDeps.join(' '));
165- core.setOutput('needs-install', missingDeps.length > 0 ? 'true' : 'false');
160+ if (missingDeps.length > 0) {
161+ core.setOutput('missing-deps', missingDeps.join(' '));
162+ }
166163
167164 - name : Install missing Codecov dependencies
168- if : inputs.coverage == 'codecov' && inputs.container == 'true' && steps.check-codecov-deps.outputs.needs-install == 'true'
165+ if : always() && steps.check-codecov-deps.outputs.missing-deps
169166 uses : pkgxdev/setup@f211ee4db3110b42e5a156282372527e7c1ed723 # v4.0.0
170167 with :
171- + : git curl gnupg.org
168+ + : ${{ steps.check-codecov-deps.outputs.missing-deps }}
172169
173170 # Fix pkgxdev gnupg's gpgconf.ctl which contains unexpanded environment variables
174171 - name : Fix GPG configuration
175- if : inputs.coverage == 'codecov' && inputs.container == 'true'
172+ if : always() && contains(steps.check-codecov-deps.outputs.missing-deps, 'gnupg.org')
176173 uses : actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
177174 with :
178175 script : |
0 commit comments