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
87 changes: 78 additions & 9 deletions .github/workflows/portfolio-v2-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@ name: Portfolio V2 CI
on:
pull_request:
branches: ["main"]
paths:
- "portfolio-v2/**"
- ".github/workflows/portfolio-v2-ci.yml"
- ".github/workflows/portfolio-project-sync.yml"
- ".github/prompts/**"
workflow_dispatch:

permissions:
contents: read
contents: write
issues: write
pull-requests: write

jobs:
build:
Expand All @@ -20,6 +17,9 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name || github.repository }}
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref_name }}

- name: Setup Node
uses: actions/setup-node@v4
Expand All @@ -28,8 +28,77 @@ jobs:
cache: npm
cache-dependency-path: portfolio-v2/package-lock.json

- name: Build Portfolio V2
- name: Install Dependencies
working-directory: portfolio-v2
run: npm ci

- name: Format Code
working-directory: portfolio-v2
run: npm run format

- name: Project Health and Clean up
id: project_health
working-directory: portfolio-v2
run: |
npm run project:health:fix
cat project-health-summary.md >> "$GITHUB_STEP_SUMMARY"

- name: Commit Automated Cleanups
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
run: |
set -euo pipefail

if git diff --quiet; then
echo "No automated formatting or project cleanup changes were needed." >> "$GITHUB_STEP_SUMMARY"
exit 0
fi

git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add -A
git commit -m "Apply automated portfolio cleanup"
git push
echo "Committed automated formatting or project cleanup changes to this PR branch." >> "$GITHUB_STEP_SUMMARY"

- name: Check Code Formatting
working-directory: portfolio-v2
run: npm run format:check

- name: Comment Project Health Review
if: always() && github.event_name == 'pull_request' && steps.project_health.outputs.status == 'needs_review'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
npm ci
npm run build
set -euo pipefail

MARKER="<!-- project-health-cleanup -->"
COMMENT_ID="$(gh api "repos/$GITHUB_REPOSITORY/issues/$PR_NUMBER/comments" \
--jq ".[] | select(.body | contains(\"$MARKER\")) | .id" | tail -n 1)"

COMMENT_FILE="$RUNNER_TEMP/project-health-comment.md"
{
echo "$MARKER"
if [ -f portfolio-v2/project-health-summary.md ]; then
cat portfolio-v2/project-health-summary.md
else
echo "Project Health and Clean up did not produce a summary. Please inspect the workflow logs."
fi
} > "$COMMENT_FILE"

if [ -n "$COMMENT_ID" ]; then
gh api --method PATCH "repos/$GITHUB_REPOSITORY/issues/comments/$COMMENT_ID" \
--field "body=$(cat "$COMMENT_FILE")"
else
gh pr comment "$PR_NUMBER" --body-file "$COMMENT_FILE"
fi

- name: Fail on Project Health Issues
if: steps.project_health.outputs.status == 'needs_review'
run: |
echo "Project Health and Clean up found issues. See the workflow summary or PR comment."
exit 1

- name: Build Portfolio V2
working-directory: portfolio-v2
run: npm run build
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
linkedin-proof-assets/
portfolio-v2/node_modules/
portfolio-v2/dist/
portfolio-v2/project-health-summary.md
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
portfolio-v2/dist/
portfolio-v2/node_modules/
portfolio-v2/project-health-summary.md
linkedin-proof-assets/
6 changes: 6 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"printWidth": 120,
"semi": true,
"singleQuote": false,
"trailingComma": "es5"
}
2 changes: 1 addition & 1 deletion portfolio-v2/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<meta property="og:type" content="website" />
<meta property="og:url" content="https://vikramsh2002.github.io/My-Portfolio/" />
<meta property="og:image" content="%BASE_URL%images/MyLogoDark.png" />
<link rel="icon" href="%BASE_URL%images/MyLogoDark.png" type="image/png" />
<link rel="icon" href="/images/MyLogoDark.png" type="image/png" />
<title>Vikram Sharma | Python Backend Engineer</title>
</head>
<body>
Expand Down
17 changes: 17 additions & 0 deletions portfolio-v2/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion portfolio-v2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
"scripts": {
"dev": "vite --host 127.0.0.1",
"build": "vite build",
"preview": "vite preview --host 127.0.0.1"
"preview": "vite preview --host 127.0.0.1",
"format": "prettier --write --config ../.prettierrc.json --ignore-path ../.prettierignore \"src/**/*.{js,jsx,json,css}\" \"scripts/**/*.mjs\" \"index.html\" \"package.json\" \"docs/**/*.md\" \"../README.md\" \"../.github/**/*.{yml,yaml}\"",
"format:check": "prettier --check --config ../.prettierrc.json --ignore-path ../.prettierignore \"src/**/*.{js,jsx,json,css}\" \"scripts/**/*.mjs\" \"index.html\" \"package.json\" \"docs/**/*.md\" \"../README.md\" \"../.github/**/*.{yml,yaml}\"",
"project:health": "node scripts/checkProjectHealth.mjs",
"project:health:fix": "node scripts/checkProjectHealth.mjs --fix"
},
"dependencies": {
"lucide-react": "^0.468.0",
Expand All @@ -15,6 +19,7 @@
},
"devDependencies": {
"@vitejs/plugin-react": "^4.3.4",
"prettier": "^3.8.3",
"vite": "^5.4.11"
}
}
4 changes: 3 additions & 1 deletion portfolio-v2/scripts/applyPortfolioProjectUpdate.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,9 @@ function labelForLink(href) {
}

function clean(value) {
return String(value || "").replace(/\s+/g, " ").trim();
return String(value || "")
.replace(/\s+/g, " ")
.trim();
}

function findExistingProject(projects, matchTitle, project) {
Expand Down
Loading
Loading