8000 fix: resolve security alerts and streamline repository workflows by dominicusin · Pull Request #430 · dominicusin/dominicusin.github.io · GitHub
[go: up one dir, main page]

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
14 changes: 6 additions & 8 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ updates:
time: "09:00"
timezone: "UTC"
open-pull-requests-limit: 10
auto-merge: true
labels:
- "dependencies"
ignore:
Expand All @@ -26,7 +25,6 @@ updates:
time: "10:00"
timezone: "UTC"
open-pull-requests-limit: 10
auto-merge: true
labels:
- "dependencies"
groups:
Expand All @@ -38,12 +36,12 @@ updates:
prefix: "deps"
prefix-development: "dev-deps"

# Maintain dependencies for Ruby (if applicable)
- package-ecosystem: "bundler"
directory: "/"
# Small dependency set required by the Hugo publishing scripts.
- package-ecosystem: "npm"
directory: "/scripts"
schedule:
interval: "weekly"
day: "tuesday"
time: "10:00"
day: "monday"
time: "10:30"
timezone: "UTC"
open-pull-requests-limit: 10
open-pull-requests-limit: 5
8 changes: 0 additions & 8 deletions .github/workflows/agent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,6 @@ jobs:
- name: Run existing tests
run: npm test

- name: Hugo build
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.164.0'
extended: true

- run: hugo --gc --minify

- name: Upload agent artifacts
uses: actions/upload-artifact@v4
with:
Expand Down
129 changes: 43 additions & 86 deletions .github/workflows/awesome.yml
10BC8
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
name: Awesome Lists (discover + refresh)

# Consolidated from awesome-discover.yml + awesome-refresh.yml.
# - discover: finds new curated Awesome lists and opens a PR
# - refresh: advances existing awesome/* submodules to latest tips
name: Awesome Lists (refresh + discover)

on:
schedule:
- cron: "17 6 * * 1" # every Monday 06:17 UTC
- cron: "17 6 * * 1"
workflow_dispatch:
inputs:
max_new:
description: "Max new lists to add this run"
description: "Maximum number of lists to add"
required: false
default: "3"
min_stars:
Expand All @@ -19,18 +15,25 @@ on:
default: "800"

permissions:
actions: write
contents: write
pull-requests: write

concurrency:
group: awesome-maintenance
cancel-in-progress: false

jobs:
discover:
update:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
with:
submodules: false
- name: 🛡️ Ignore nested submodules (avoid recursive fatal)
fetch-depth: 0

- name: Disable nested submodules
run: |
git config --global submodule."awesome/tools/open-source-ios-apps/ReadmeGenerator".active false
git config --global submodule."awesome/tools/open-source-mac-os-apps/ReadmeGenerator".active false
Expand All @@ -43,105 +46,59 @@ jobs:
with:
node-version: "24"

- name: 📥 Init submodules (non-recursive)
# Checkout uses submodules:false so it won't recurse into nested
# submodules (e.g. open-source-ios-apps/ReadmeGenerator) absent from our
# root .gitmodules. We init only the direct submodules the job needs.
run: |
git submodule update --init themes/blowfish
git submodule update --init awesome
- name: Initialize curated lists
run: git submodule update --init --jobs 4 themes/blowfish awesome

- name: Discover and add new awesome lists
- name: Refresh and discover lists
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AWESOME_MAX_NEW: ${{ github.event.inputs.max_new || '3' }}
AWESOME_MIN_STARS: ${{ github.event.inputs.min_stars || '800' }}
run: node scripts/discover-awesome.cjs
run: |
node scripts/refresh-awesome.cjs
node scripts/discover-awesome.cjs
node scripts/build-awesome.cjs

- name: Rebuild catalog data
run: node scripts/build-awesome.cjs
- name: Setup Hugo (extended)
uses: peaceiris/actions-hugo@v3
with:
hugo-version: "0.164.0"
extended: true

- name: Build site (guard — new lists must not break the build)
# Renders the /awesome/ catalog + preview pages. If a freshly added
# list (or its README) breaks the build, the workflow fails HERE
# (before opening a PR) instead of merging broken content later.
- name: Validate the updated catalog
run: |
hugo --gc --minify --baseURL "https://example.com/"
rm -rf public resources


- name: Open PR if anything changed
id: pr
- name: Create or update the maintenance pull request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Stage submodule registration + any new gitlinks
git add .gitmodules awesome
if git diff --cached --quiet; then
echo "nothing to commit"
echo "changed=false" >> "$GITHUB_OUTPUT"
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
BRANCH="bot/awesome-discover-$(date +%Y%m%d-%H%M%S)"
git checkout -b "$BRANCH"
git commit -m "bot: discover new curated awesome lists"
git push --force-with-lease origin "$BRANCH"
gh pr create \
--title "bot: discover new curated awesome lists" \
--body "Automated discovery added new awesome lists as sparse submodules under content/awesome/. Review and merge." \
--label "awesome" --auto || true
echo "changed=true" >> "$GITHUB_OUTPUT"

refresh:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
with:
submodules: false
- name: 🛡️ Ignore nested submodules (avoid recursive fatal)
run: |
git config --global submodule."awesome/tools/open-source-ios-apps/ReadmeGenerator".active false
git config --global submodule."awesome/tools/open-source-mac-os-apps/ReadmeGenerator".active false
git config --global submodule."awesome/tools/open-source-ios-apps/ReadmeGenerator".update none
git config --global submodule."awesome/tools/open-source-mac-os-apps/ReadmeGenerator".update none
git config --global submodule.recurse false

- name: Setup Node
uses: actions/setup-node@v7
with:
node-version: "24"

- name: 📥 Init awesome submodules (non-recursive)
run: git submodule update --init awesome

- name: Refresh awesome submodules + rebuild catalog
id: refresh
run: node scripts/refresh-awesome.cjs

- name: Open PR if anything changed
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git add .gitmodules awesome data/awesome.json
if git diff --cached --quiet; then
echo "nothing to commit"
echo "No curated-list changes to publish."
exit 0
fi

git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
BRANCH="bot/awesome-refresh-$(date +%Y%m%d-%H%M%S)"
git checkout -b "$BRANCH"
branch="bot/awesome-maintenance"
git checkout -B "$branch"
git commit -m "bot: refresh curated awesome lists"
git push --force-with-lease origin "$BRANCH"
gh pr create \
--title "bot: refresh curated awesome lists" \
--body "Automated refresh advanced the awesome/* submodules to their latest READMEs and regenerated the catalog. Review and merge." \
--label "awesome" --auto || true
git push --force-with-lease origin "$branch"

pr_number="$(gh pr list --head "$branch" --base main --json number --jq '.[0].number // empty')"
if [ -z "$pr_number" ]; then
gh pr create \
--base main \
--head "$branch" \
--title "bot: refresh curated awesome lists" \
--body "Weekly refresh of existing Awesome lists and discovery of new curated lists. The catalog is built with Hugo before this PR is opened." \
--label "awesome"
else
gh pr edit "$pr_number" \
--title "bot: refresh curated awesome lists" \
--body "Weekly refresh of existing Awesome lists and discovery of new curated lists. The catalog is built with Hugo before this PR is updated."
fi

gh workflow run quality.yml --ref "$branch"
75 changes: 0 additions & 75 deletions .github/workflows/dependency-update.yml

This file was deleted.

19 changes: 8 additions & 11 deletions .github/workflows/hugo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: Deploy Hugo site to GitHub Pages
on:
push:
branches: [main]
# Auto-update: re-sync repos/gists from GitHub every 2 hours + on dispatch.
# Reduced from 30min (48 runs/day) to 2h (12 runs/day) — 75% fewer builds.
# Refresh GitHub repos/gists every 2 hours; curated submodules update weekly
# in awesome.yml, keeping the publishing job focused on rendering and deploy.
schedule:
- cron: "17 */2 * * *"
repository_dispatch:
Expand Down Expand Up @@ -47,9 +47,9 @@ jobs:
git config --global submodule."awesome/tools/open-source-mac-os-apps/ReadmeGenerator".update none
git config --global submodule.recurse false

- name: Init submodules (parallel, non-recursive)
- name: Init Hugo theme submodule
run: |
git submodule update --init --jobs 4 themes/blowfish awesome
git submodule update --init themes/blowfish
node scripts/ensure-awesome-sparse.cjs || true

- name: Generate wiki navigation
Expand All @@ -67,9 +67,9 @@ jobs:
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
key: ${{ runner.os }}-node-site-tools-${{ hashFiles('scripts/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
${{ runner.os }}-node-site-tools-

- name: Setup Hugo (extended)
uses: peaceiris/actions-hugo@v3
Expand All @@ -93,8 +93,8 @@ jobs:
id: pages
uses: actions/configure-pages@v5

- name: Install deps (content-contract scripts)
run: npm ci --prefer-offline --no-audit --no-fund
- name: Install site-build dependencies
run: npm ci --prefix scripts --prefer-offline --no-audit --no-fund

- name: Sync GitHub repos + gists (auto-ingest)
run: node scripts/sync-github.cjs
Expand All @@ -112,9 +112,6 @@ jobs:
node scripts/build-crosslinks.cjs &
wait

- name: Refresh Awesome submodules (pull latest READMEs)
run: node scripts/refresh-awesome.cjs || true

- name: Build Awesome catalog (parse .gitmodules -> data/awesome.json)
run: node scripts/build-awesome.cjs

Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,11 @@ jobs:
${{ runner.os }}-hugo-${{ hashFiles('package-lock.json') }}-
${{ runner.os }}-hugo-

- name: 📥 Init submodules (non-recursive)
# Checkout uses submodules:false to avoid recursing into nested
# submodules (e.g. awesome/tools/open-source-ios-apps contains a
# ReadmeGenerator submodule absent from our .gitmodules -> fatal).
# We init only the direct submodules the build needs, non-recursively.
- name: 📥 Init Hugo theme submodule
# The catalog is committed in data/awesome.json. Hugo only needs its theme;
# initializing awesome/ would clone dozens of unrelated nested repositories.
run: |
git submodule update --init themes/blowfish
git submodule update --init awesome

- name: 📦 Install dependencies
run: npm ci --prefer-offline --no-audit --no-fund
Expand Down
Loading
Loading
0