Top Repositories Data
+| Repository | +Stars | +
|---|
From 7526192154a1c3d4a885780ee00f6b2792928b8b Mon Sep 17 00:00:00 2001 From: John Ajera <37360952+jajera@users.noreply.github.com> Date: Tue, 31 Dec 2024 07:05:26 +0000 Subject: [PATCH] feat: set initial configuration defines initial configuration --- .github/workflows/commitmsg-conform.yml | 11 ++++ .github/workflows/markdown-lint.yml | 11 ++++ .github/workflows/update-metrics.yml | 67 +++++++++++++++++++++++ README.md | 2 +- data/metrics.json | 2 + index.html | 43 +++++++++++++++ scripts.js | 42 +++++++++++++++ style.css | 72 +++++++++++++++++++++++++ 8 files changed, 249 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/commitmsg-conform.yml create mode 100644 .github/workflows/markdown-lint.yml create mode 100644 .github/workflows/update-metrics.yml create mode 100644 data/metrics.json create mode 100644 index.html create mode 100644 scripts.js create mode 100644 style.css diff --git a/.github/workflows/commitmsg-conform.yml b/.github/workflows/commitmsg-conform.yml new file mode 100644 index 0000000..e7b4d63 --- /dev/null +++ b/.github/workflows/commitmsg-conform.yml @@ -0,0 +1,11 @@ +name: commit-message-conformance +on: + pull_request: {} +permissions: + statuses: write + checks: write + contents: read + pull-requests: read +jobs: + commitmsg-conform: + uses: actionsforge/actions/.github/workflows/commitmsg-conform.yml@main diff --git a/.github/workflows/markdown-lint.yml b/.github/workflows/markdown-lint.yml new file mode 100644 index 0000000..d9a2d67 --- /dev/null +++ b/.github/workflows/markdown-lint.yml @@ -0,0 +1,11 @@ +name: markdown-lint +on: + pull_request: {} +permissions: + statuses: write + checks: write + contents: read + pull-requests: read +jobs: + markdown-lint: + uses: actionsforge/actions/.github/workflows/markdown-lint.yml@main diff --git a/.github/workflows/update-metrics.yml b/.github/workflows/update-metrics.yml new file mode 100644 index 0000000..417bdbb --- /dev/null +++ b/.github/workflows/update-metrics.yml @@ -0,0 +1,67 @@ +name: update-gh-pages-metrics + +on: + schedule: + - cron: '0 0 * * 1' # Weekly schedule + workflow_dispatch: # Manual trigger + +permissions: + contents: write + statuses: write + +jobs: + update-metrics: + runs-on: ubuntu-latest + + steps: + # Step 1: Checkout the repository + - name: Checkout repository + uses: actions/checkout@v4 + + # Step 2: Install jq for JSON processing + - name: Install jq + run: | + sudo apt-get update + sudo apt-get install -y jq + + # Step 3: Fetch and generate metrics.json + - name: Generate metrics.json + env: + API_URL: "https://api.github.com/orgs/${{ github.repository_owner }}/repos" + METRICS_FILE: "data/metrics.json" + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # Validate token availability + if [[ -z "$GITHUB_TOKEN" ]]; then + echo "Error: GITHUB_TOKEN is not available." + exit 1 + fi + + # Prepare directories + rm -rf data && mkdir -p data + + # Fetch repository data + status_code=$(curl -s -o response.json -w "%{http_code}" -H "Authorization: token $GITHUB_TOKEN" "$API_URL") + + # Check HTTP status code + if [ "$status_code" -ne 200 ]; then + echo "Failed to fetch repository data. HTTP Status: $status_code" + echo "Response:" + cat response.json + exit 1 + fi + + # Parse and sort repositories by stargazers_count (top 5) + repos=$(jq -r '.[] | {(.name): .stargazers_count}' response.json | jq -s add | jq -r 'to_entries | sort_by(-.value)[:5] | from_entries') + + # Generate metrics.json + echo "$repos" | jq -r '.' > "$METRICS_FILE" + + echo "metrics.json generated successfully." + + # Step 4: Commit and push changes + - name: Commit and push changes + uses: EndBug/add-and-commit@v9 + with: + message: "Update metrics.json with top repositories" + add: "data/metrics.json" diff --git a/README.md b/README.md index 01acd06..ae705f8 100644 --- a/README.md +++ b/README.md @@ -1 +1 @@ -# actionsforge.github.io \ No newline at end of file +# actionsforge.github.io diff --git a/data/metrics.json b/data/metrics.json new file mode 100644 index 0000000..2c63c08 --- /dev/null +++ b/data/metrics.json @@ -0,0 +1,2 @@ +{ +} diff --git a/index.html b/index.html new file mode 100644 index 0000000..1d20a9d --- /dev/null +++ b/index.html @@ -0,0 +1,43 @@ + + +
+ + +Visualizing top repositories by GitHub stars
+| Repository | +Stars | +
|---|