Skip to content

Commit 35f391f

Browse files
Copilotcommjoen
andcommitted
Fix pre-commit errors: remove trailing whitespace and add EOF newline
Co-authored-by: commjoen <[email protected]>
1 parent 811bf1b commit 35f391f

File tree

1 file changed

+50
-50
lines changed

1 file changed

+50
-50
lines changed

.github/workflows/github-pages-preview.yml

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,21 @@ jobs:
4444
run: |
4545
echo "Building WrongSecrets application..."
4646
./mvnw --no-transfer-progress clean package -DskipTests
47-
47+
4848
# Verify JAR was created
4949
find target -name "*.jar" -type f | head -5
5050
5151
- name: Create static preview content
5252
run: |
5353
echo "Creating static preview for PR #${{ github.event.number }}..."
54-
54+
5555
# Create the preview directory structure
5656
mkdir -p static-site/pr-${{ github.event.number }}
57-
57+
5858
# Copy static assets (CSS, JS, images, etc.)
5959
echo "Copying static assets..."
6060
cp -r src/main/resources/static/* static-site/pr-${{ github.event.number }}/ 2>/dev/null || true
61-
61+
6262
# Create a simple landing page for this PR preview
6363
cat > static-site/pr-${{ github.event.number }}/index.html << 'EOF'
6464
<!DOCTYPE html>
@@ -82,7 +82,7 @@ jobs:
8282
<p><strong>Commit:</strong> <code>${{ github.sha }}</code></p>
8383
<p><strong>For full functionality:</strong> Please use the Docker preview from the <a href="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" target="_blank">GitHub Actions build</a>.</p>
8484
</div>
85-
85+
8686
<div class="card">
8787
<div class="card-header">
8888
<h5>📁 Available Preview Content</h5>
@@ -95,12 +95,12 @@ jobs:
9595
<li>✅ Images, icons, and static assets</li>
9696
<li>⚠️ Template structure (limited dynamic content)</li>
9797
</ul>
98-
98+
9999
<h6 class="mt-3">📋 Key Files Changed in This PR:</h6>
100100
<div id="changed-files">
101101
<em>Loading changed files...</em>
102102
</div>
103-
103+
104104
<div class="mt-3">
105105
<a href="${{ github.server_url }}/${{ github.repository }}/pull/${{ github.event.number }}" class="btn btn-primary" target="_blank">
106106
View Full PR Details
@@ -114,27 +114,27 @@ jobs:
114114
</div>
115115
</div>
116116
</div>
117-
117+
118118
<script>
119119
// Try to fetch and display changed files information
120120
(async function() {
121121
try {
122122
const response = await fetch('${{ github.api_url }}/repos/${{ github.repository }}/pulls/${{ github.event.number }}/files');
123123
const files = await response.json();
124-
125-
const relevantFiles = files.filter(file =>
124+
125+
const relevantFiles = files.filter(file =>
126126
file.filename.includes('templates/') ||
127127
file.filename.includes('static/') ||
128128
file.filename.includes('explanations/') ||
129129
file.filename.includes('src/main/java/')
130130
);
131-
131+
132132
const changedFilesDiv = document.getElementById('changed-files');
133133
if (relevantFiles.length > 0) {
134-
changedFilesDiv.innerHTML = '<ul>' +
135-
relevantFiles.slice(0, 10).map(file =>
134+
changedFilesDiv.innerHTML = '<ul>' +
135+
relevantFiles.slice(0, 10).map(file =>
136136
`<li><code>${file.filename}</code> <span class="badge bg-${file.status === 'added' ? 'success' : file.status === 'removed' ? 'danger' : 'warning'}">${file.status}</span></li>`
137-
).join('') +
137+
).join('') +
138138
(relevantFiles.length > 10 ? `<li><em>... and ${relevantFiles.length - 10} more files</em></li>` : '') +
139139
'</ul>';
140140
} else {
@@ -154,7 +154,7 @@ jobs:
154154
run: |
155155
# Create or update the main index page that lists all PR previews
156156
mkdir -p static-site
157-
157+
158158
cat > static-site/index.html << 'EOF'
159159
<!DOCTYPE html>
160160
<html lang="en">
@@ -163,29 +163,29 @@ jobs:
163163
<meta name="viewport" content="width=device-width, initial-scale=1.0">
164164
<title>OWASP WrongSecrets - PR Previews</title>
165165
<style>
166-
body {
167-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
168-
margin: 40px;
166+
body {
167+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
168+
margin: 40px;
169169
background-color: #f8f9fa;
170170
}
171171
.container { max-width: 1200px; margin: 0 auto; }
172172
.header { text-align: center; margin-bottom: 40px; }
173173
.pr-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
174-
.pr-card {
175-
background: white;
176-
padding: 20px;
177-
border-radius: 8px;
174+
.pr-card {
175+
background: white;
176+
padding: 20px;
177+
border-radius: 8px;
178178
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
179179
border-left: 4px solid #0366d6;
180180
}
181181
.pr-link { text-decoration: none; color: #0366d6; font-weight: bold; font-size: 1.2em; }
182182
.pr-link:hover { text-decoration: underline; }
183183
.meta { color: #666; font-size: 0.9em; margin-top: 10px; }
184-
.badge {
185-
background: #e1f5fe;
186-
color: #01579b;
187-
padding: 2px 8px;
188-
border-radius: 12px;
184+
.badge {
185+
background: #e1f5fe;
186+
color: #01579b;
187+
padding: 2px 8px;
188+
border-radius: 12px;
189189
font-size: 0.8em;
190190
}
191191
</style>
@@ -197,7 +197,7 @@ jobs:
197197
<h2>Pull Request Previews</h2>
198198
<p>Static previews of pull requests for UI and template changes</p>
199199
</div>
200-
200+
201201
<div id="pr-list">
202202
<div class="pr-grid">
203203
<div class="pr-card">
@@ -210,10 +210,10 @@ jobs:
210210
</div>
211211
</div>
212212
</div>
213-
213+
214214
<div style="text-align: center; margin-top: 40px; color: #666;">
215215
<p>
216-
<a href="${{ github.server_url }}/${{ github.repository }}" target="_blank">View Repository</a> |
216+
<a href="${{ github.server_url }}/${{ github.repository }}" target="_blank">View Repository</a> |
217217
<a href="${{ github.server_url }}/${{ github.repository }}/pulls" target="_blank">All Pull Requests</a>
218218
</p>
219219
<small>Generated by GitHub Actions</small>
@@ -231,7 +231,7 @@ jobs:
231231
with:
232232
path: ./static-site
233233

234-
- name: Deploy to GitHub Pages
234+
- name: Deploy to GitHub Pages
235235
id: deployment
236236
uses: actions/deploy-pages@v4
237237

@@ -241,25 +241,25 @@ jobs:
241241
script: |
242242
const prNumber = context.issue.number;
243243
const previewUrl = `${{ steps.deployment.outputs.page_url }}pr-${prNumber}/`;
244-
244+
245245
const comment = `🌐 **GitHub Pages Preview Ready!**
246-
246+
247247
Your static preview is now available at:
248248
**🔗 [Preview PR #${prNumber}](${previewUrl})**
249-
249+
250250
📄 **What's included:**
251-
- ✅ All CSS, JavaScript, and static assets
251+
- ✅ All CSS, JavaScript, and static assets
252252
- ✅ Current styling and layout preview
253253
- ✅ Images, icons, and UI components
254254
- ⚠️ Limited dynamic functionality (static preview only)
255-
255+
256256
**For full functionality testing:** Use the [Docker preview](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) instead.
257-
257+
258258
**🔄 Auto-updates:** This preview will be updated automatically when you push new commits to this PR.
259-
259+
260260
---
261261
<sub>Static preview generated by GitHub Actions</sub>`;
262-
262+
263263
github.rest.issues.createComment({
264264
issue_number: prNumber,
265265
owner: context.repo.owner,
@@ -280,27 +280,27 @@ jobs:
280280
run: |
281281
PR_NUMBER=${{ github.event.number }}
282282
echo "Cleaning up preview for PR #${PR_NUMBER}..."
283-
283+
284284
# Check if gh-pages branch exists
285285
if git ls-remote --exit-code --heads origin gh-pages >/dev/null 2>&1; then
286286
echo "gh-pages branch exists, proceeding with cleanup..."
287-
287+
288288
# Checkout gh-pages branch
289289
git checkout gh-pages || {
290290
echo "Failed to checkout gh-pages branch, it may not exist yet"
291291
exit 0
292292
}
293-
293+
294294
PR_DIR="pr-${PR_NUMBER}"
295-
295+
296296
if [ -d "$PR_DIR" ]; then
297297
echo "Removing preview directory: $PR_DIR"
298298
rm -rf "$PR_DIR"
299-
299+
300300
# Configure git
301301
git config user.name github-actions[bot]
302302
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
303-
303+
304304
# Commit and push the removal
305305
git add .
306306
if git commit -m "Clean up preview for closed PR #${PR_NUMBER}"; then
@@ -321,17 +321,17 @@ jobs:
321321
with:
322322
script: |
323323
const comment = `🧹 **Preview Cleanup Complete**
324-
324+
325325
The static preview for this PR has been removed from GitHub Pages.
326-
326+
327327
Thanks for contributing to WrongSecrets! 🎉
328-
328+
329329
---
330330
<sub>Cleanup completed by GitHub Actions</sub>`;
331-
331+
332332
github.rest.issues.createComment({
333333
issue_number: context.issue.number,
334334
owner: context.repo.owner,
335335
repo: context.repo.repo,
336336
body: comment
337-
});
337+
});

0 commit comments

Comments
 (0)