Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT_TOKEN }} # Use PAT instead of GITHUB_TOKEN
token: ${{ secrets.PAT_TOKEN }}
fetch-depth: 0
ref: ${{ github.head_ref || github.ref }}

Expand All @@ -32,11 +32,21 @@ jobs:
git config --global --add safe.directory $PWD
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

# Set up authentication
git remote set-url origin https://x-access-token:${{ secrets.PAT_TOKEN }}@github.com/${{ github.repository }}.git

# Run formatting
pre-commit run --all-files || true

# Only push if there are actual changes
if ! git diff --quiet; then
git add -A
git commit -m "style: auto-format code with clang-format [skip ci]"
git push
echo "✓ Code formatted and pushed"
else
echo "✓ No formatting changes needed"
fi

- name: Build C code
Expand Down
9 changes: 8 additions & 1 deletion src/app/index.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ Index(ResponseWriter* w, Request* r)
SetStatus(w, 200, "OK");
SetHeader(w, "Content-Type", "text/html");
char buffer[300];
snprintf(buffer, 300, "<html><body style=\"display:flex;align-items:center;justify-content:center;background:#000;color:#fff;\"><div style=\"width:fit-content;height:fit-content;\"><h1>A Minimalistic C Server</h1><p>Request path: %s</p></div></body></html>", r->path.data);
snprintf(buffer, 300,
"<html><body "
"style=\"display:flex;align-items:center;justify-content:"
"center;background:#000;color:#fff;\"><div "
"style=\"width:fit-content;height:fit-content;\"><h1>A "
"Minimalistic C Server</h1><p>Request path: "
"%s</p></div></body></html>",
r->path.data);
w->WriteString(w, buffer);

return EXIT_SUCCESS;
Expand Down