Skip to content

Commit 5070c2a

Browse files
fix: correct workflow exit code logic
Co-authored-by: unknowIfGuestInDream <57802425+unknowIfGuestInDream@users.noreply.github.com>
1 parent 16b9400 commit 5070c2a

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

.github/workflows/sync-vscode-engine.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ jobs:
5151
5252
- name: Update engines.vscode
5353
if: steps.check_update.outputs.types_vscode_updated == 'true'
54+
id: update_engine
5455
run: |
5556
TYPES_VERSION="${{ steps.check_update.outputs.types_version }}"
5657
@@ -74,18 +75,22 @@ jobs:
7475
pkg.engines.vscode = newEngine;
7576
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n');
7677
console.log('Updated engines.vscode');
77-
process.exit(0);
78+
console.log('changes_made=true');
7879
} else {
7980
console.log('No update needed');
80-
process.exit(1);
81+
console.log('changes_made=false');
8182
}
82-
"
83+
" | tee /tmp/update-output.txt
8384
84-
# Store the exit code
85-
echo "update_needed=$?" >> $GITHUB_ENV
85+
# Extract the changes_made value from output
86+
if grep -q "changes_made=true" /tmp/update-output.txt; then
87+
echo "changes_made=true" >> $GITHUB_OUTPUT
88+
else
89+
echo "changes_made=false" >> $GITHUB_OUTPUT
90+
fi
8691
8792
- name: Commit changes
88-
if: steps.check_update.outputs.types_vscode_updated == 'true' && env.update_needed == '0'
93+
if: steps.check_update.outputs.types_vscode_updated == 'true' && steps.update_engine.outputs.changes_made == 'true'
8994
run: |
9095
git config --local user.email "github-actions[bot]@users.noreply.github.com"
9196
git config --local user.name "github-actions[bot]"

0 commit comments

Comments
 (0)