commit c3f3b081a3698119ab5d0006cca1aa28158b50bf Author: Minerva_juppiter <94231606+minerva-jupiter@users.noreply.github.com> Date: Wed, 9 Sep 2026 03:15:56 +0900 Update cron schedule and add repository_dispatch event Diffstat:
| A | .github/workflows/stagit-build.yml | | | 52 | ++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1 file changed, 52 insertions(+), 0 deletions(-)
diff --git a/.github/workflows/stagit-build.yml b/.github/workflows/stagit-build.yml @@ -0,0 +1,52 @@ +name: Build Stagit Portal + +on: + schedule: + - cron: '36 */3 * * *' + repository_dispatch: + types: [repo_pushed] + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: write + pages: write + id-token: write + + steps: + - name: Install stagit + run: | + sudo apt-get update + sudo apt-get install -y stagit git + + - name: Fetch repository list and generate HTML + env: + GH_TOKEN: ${{ secrets.PORTAL_PAT }} # PAT(Personal Access Token) + run: | + mkdir repos site + cd repos + + # API経由でアカウント内の全パブリック/プライベートリポジトリのclone URLを取得 + gh repo list --limit 1000 --json name,cloneUrl,description,isPrivate -q '.[]' > repos_info.json + + # 各リポジトリを bare clone して stagit を個別ビルド + cat repos_info.json | jq -r '.cloneUrl' | while read -r url; do + repo_name=$(basename "$url" .git) + git clone --bare "$url" "${repo_name}.git" + + mkdir -p "../site/${repo_name}" + cd "${repo_name}.git" + stagit "../site/${repo_name}" + cd .. + done + + # ルート目録用(stagit-index)の生成 + stagit-index *.git > ../site/index.html + + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@main + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./site