diff --git a/.env.example b/.env.example deleted file mode 100644 index f974114..0000000 --- a/.env.example +++ /dev/null @@ -1 +0,0 @@ -VITE_GITHUB_ACCESS_TOKEN=YOUR_GITHUB_ACCESS_TOKEN \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a32be21..20674ec 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,9 +12,6 @@ jobs: build: runs-on: ubuntu-latest - env: - VITE_GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} - steps: - name: Checkout code uses: actions/checkout@v3 @@ -27,5 +24,33 @@ jobs: - name: Install dependencies run: npm install + - name: Lint code + run: npm run lint + - name: Build app run: npm run build + + - name: Checks Failed + if: failure() + uses: actions/github-script@v6 + with: + script: | + core.setFailed("Linting or build errors detected. Please fix them and push again.") + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: "⚠️ Looks like you missed something Linting or build errors detected. Please fix them and push again." + }) + + - name: All Checks Passed + if: success() + uses: actions/github-script@v6 + with: + script: | + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: "Kudos! All checks passed. 🎉 Thanks for contributing to the project, one of our maintainers will review your changes soon." + }) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index cb4fe81..6ef1a53 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,9 +1,9 @@ name: Deploy to GitHub Pages 🚀 on: - push: - branches: - - main + push: + branches: + - main permissions: contents: read @@ -21,9 +21,6 @@ jobs: url: ${{steps.deployment.outputs.page_url}} runs-on: ubuntu-latest - env: - VITE_GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} - steps: - name: Checkout uses: actions/checkout@v3 diff --git a/src/components/StatusBar.tsx b/src/components/StatusBar.tsx index 324e665..fc48de7 100644 --- a/src/components/StatusBar.tsx +++ b/src/components/StatusBar.tsx @@ -3,17 +3,11 @@ import Tooltip from "./Elements/Tooltip" import { Chrome, Copyright, Eye, Fullscreen, GitBranch, GitFork, Github, Hash, Scale, Star } from "lucide-react" import values from "@/values/strings.json" -type License = { - key: string, - name: string, - url: string, -} - type RepositoryData = { stargazers_count: number, forks_count: number, watchers_count: number, - license: License, + full_name: string } function StatusBar() { @@ -24,15 +18,14 @@ function StatusBar() { const fetchRepositoryData = async () => { // make fetch request with above using fetch api // Add X-GitHub-Api-Version: 2022-11-28 header to request - const headers = new Headers() - headers.append('Accept', 'application/vnd.github.v3+json') - headers.append('X-GitHub-Api-Version', '2022-11-28') - headers.append('Authorization', `token ${import.meta.env.VITE_GITHUB_ACCESS_TOKEN}`) - const response = await fetch('https://api.github.com/repos/salman-ibrahim/codefolio', { - headers: headers - }) + // const endpoint = 'https://api.github.com/repos/salman-ibrahim/codefolio' + const endpoint = 'https://api.github.com/search/repositories?q=salman-ibrahim/codefolio' + const response = await fetch(endpoint) const data = await response.json() - setRepositoryData(data) + + // Filter from all the results where item.full_name === salman-ibrahim/codefolio + const repo = data.items.filter((item: RepositoryData) => item.full_name === 'salman-ibrahim/codefolio')[0] + setRepositoryData(repo) } useEffect(() => { @@ -111,12 +104,16 @@ function StatusBar() { CSS - -
- - MIT -
-
+ { + values.links.license !== undefined + && + +
+ + MIT +
+
+ }