Skip to content

Commit 536adff

Browse files
themr0cclaude
andcommitted
fix: resolve shellcheck and SonarCloud CI failures
Shellcheck: filter out deleted .sh files before running shellcheck, preventing reviewdog parse error on empty input. SonarCloud: use http.extraHeader for git auth instead of embedding token in remote URL, avoiding security hotspot. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 4ba0ad5 commit 536adff

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

.github/workflows/shellcheck.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,16 @@ jobs:
8989
- name: Get changed shell scripts
9090
id: changed-files
9191
run: |
92-
# Get list of changed .sh files
92+
# Get list of changed .sh files that still exist (exclude deletions)
9393
git fetch origin ${{ github.base_ref }}
94-
CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }}...HEAD | grep '\.sh$' || echo "")
94+
ALL_CHANGED=$(git diff --name-only origin/${{ github.base_ref }}...HEAD | grep '\.sh$' || echo "")
95+
CHANGED_FILES=""
96+
while IFS= read -r file; do
97+
if [ -n "$file" ] && [ -f "$file" ]; then
98+
CHANGED_FILES="${CHANGED_FILES:+$CHANGED_FILES
99+
}$file"
100+
fi
101+
done <<< "$ALL_CHANGED"
95102
echo "changed_files<<EOF" >> $GITHUB_OUTPUT
96103
echo "$CHANGED_FILES" >> $GITHUB_OUTPUT
97104
echo "EOF" >> $GITHUB_OUTPUT

build/scripts/deploy-gh-pages.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,9 @@ async function deploy() {
319319
git(deployDir, 'init', '-q');
320320
git(deployDir, 'config', 'user.name', 'github-actions[bot]');
321321
git(deployDir, 'config', 'user.email', 'github-actions[bot]@users.noreply.github.com');
322-
const remoteUrl = `https://x-access-token:${process.env.GITHUB_TOKEN}@github.com/${process.env.GITHUB_REPOSITORY}.git`;
323-
git(deployDir, 'remote', 'add', 'origin', remoteUrl);
322+
const repoUrl = `https://github.com/${process.env.GITHUB_REPOSITORY}.git`;
323+
git(deployDir, 'remote', 'add', 'origin', repoUrl);
324+
git(deployDir, 'config', `http.${repoUrl}.extraHeader`, `Authorization: Basic ${Buffer.from(`x-access-token:${process.env.GITHUB_TOKEN}`).toString('base64')}`);
324325

325326
// Fetch gh-pages
326327
fetchOrCreateGhPages(deployDir);

0 commit comments

Comments
 (0)