From 185781f4eddf6a22b216509e37b3ca99305faba2 Mon Sep 17 00:00:00 2001 From: "shunsock-github-central[bot]" <299142478+shunsock-github-central[bot]@users.noreply.github.com> Date: Thu, 2 Jul 2026 16:04:23 +0000 Subject: [PATCH] chore: sync shunsock/alocasia+awesome_web_pages+c+constant_with_python+dotfiles+findy_rust_mokumoku+fizzbuzz+fukinotou+gcloud_playground+homelab+kanji+lnix+mahjong_meetup+morse-code-japanese+playground+polix+pollenso+resume+ruby_playground+shunsock_terraform+speech+timezone_translator+uv_on_docker_playground files via gh-infra --- .github/workflows/lint__csharp.yaml | 47 +++++++++++ .github/workflows/lint__github_actions.yaml | 86 +++++++++++++++++++++ .github/workflows/lint__shell.yaml | 50 ++++++++++++ 3 files changed, 183 insertions(+) create mode 100644 .github/workflows/lint__csharp.yaml create mode 100644 .github/workflows/lint__github_actions.yaml create mode 100644 .github/workflows/lint__shell.yaml diff --git a/.github/workflows/lint__csharp.yaml b/.github/workflows/lint__csharp.yaml new file mode 100644 index 0000000..db6a866 --- /dev/null +++ b/.github/workflows/lint__csharp.yaml @@ -0,0 +1,47 @@ +name: lint__csharp + +# MANAGED BY shunsock/github_central — このファイルは gh-infra で配信される。 +# 変更は github_central 側の workflows/ で行うこと。直接編集しても同期で上書きされうる。 +# +# リポジトリ内の C# ソース (.cs) を CSharpier でフォーマット検査する。 +# .cs を持たないリポジトリでは検出ステップで止まり no-op で成功するため、 +# 全リポジトリへ安全に配信できる。 + +on: + push: + branches: [main] + pull_request: + branches: [main] + +permissions: + contents: read + +jobs: + csharpier: + name: csharpier + runs-on: ubuntu-24.04 + timeout-minutes: 5 + permissions: + contents: read + steps: + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false + + - name: Detect C# sources + id: detect + run: | + if find . -name '*.cs' -not -path './.git/*' | grep -q .; then + echo "found=true" >> "$GITHUB_OUTPUT" + fi + + # CSharpier は dotnet tool として version を固定し再現性を担保する + # (.NET SDK は runner に同梱)。 + - name: Install CSharpier + if: steps.detect.outputs.found == 'true' + run: dotnet tool install --global csharpier --version 1.3.0 + + - name: Check formatting (csharpier) + if: steps.detect.outputs.found == 'true' + run: csharpier check . diff --git a/.github/workflows/lint__github_actions.yaml b/.github/workflows/lint__github_actions.yaml new file mode 100644 index 0000000..e96058e --- /dev/null +++ b/.github/workflows/lint__github_actions.yaml @@ -0,0 +1,86 @@ +name: lint__github_actions + +# MANAGED BY shunsock/github_central — このファイルは gh-infra で配信される。 +# 変更は github_central 側の workflows/ で行うこと。直接編集しても同期で上書きされうる。 +# +# .github/workflows 配下の GitHub Actions workflow を静的解析する。 +# actionlint: 構文・式・埋め込み shell script の検証 +# ghalint: workflow のセキュリティポリシー (permission 明示・SHA pin など) の強制 +# zizmor: supply-chain 観点のセキュリティ監査 +# 3 ツールは互いに独立した観点を持つため job を分離し、片方が落ちても他方を実行する。 + +on: + push: + branches: [main] + pull_request: + branches: [main] + +permissions: + contents: read + +jobs: + actionlint: + name: actionlint + runs-on: ubuntu-24.04 + timeout-minutes: 5 + permissions: + contents: read + steps: + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false + + # actionlint は runner 同梱の shellcheck を呼び出し run ブロックの shell も検証する。 + # go install で version を固定し再現性を担保する (runner に Go は同梱)。 + - name: Install actionlint + run: | + go install github.com/rhysd/actionlint/cmd/actionlint@v1.7.12 + echo "$(go env GOPATH)/bin" >> "${GITHUB_PATH}" + + - name: Run actionlint + run: actionlint + + ghalint: + name: ghalint + runs-on: ubuntu-24.04 + timeout-minutes: 5 + permissions: + contents: read + steps: + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false + + - name: Install ghalint + run: | + go install github.com/suzuki-shunsuke/ghalint/cmd/ghalint@v1.5.6 + echo "$(go env GOPATH)/bin" >> "${GITHUB_PATH}" + + - name: Run ghalint + run: ghalint run + + zizmor: + name: zizmor + runs-on: ubuntu-24.04 + timeout-minutes: 5 + permissions: + contents: read + steps: + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false + + # zizmor 本体の version を固定し再現性を担保する。 + # private リポジトリ (GitHub Advanced Security 未契約) にも配信するため SARIF upload は + # 使わない。advanced-security: false で annotation に fallback し (security-events 権限も + # 不要)、online-audits: false で外部 API へ問い合わせず決定的に監査する。 + - name: Run zizmor + uses: zizmorcore/zizmor-action@5f14fd08f7cf1cb1609c1e344975f152c7ee938d # v0.5.6 + with: + version: v1.25.2 + advanced-security: false + annotations: true + online-audits: false diff --git a/.github/workflows/lint__shell.yaml b/.github/workflows/lint__shell.yaml new file mode 100644 index 0000000..8659767 --- /dev/null +++ b/.github/workflows/lint__shell.yaml @@ -0,0 +1,50 @@ +name: lint__shell + +# MANAGED BY shunsock/github_central — このファイルは gh-infra で配信される。 +# 変更は github_central 側の workflows/ で行うこと。直接編集しても同期で上書きされうる。 +# +# リポジトリ内の shell script に対して format (shfmt) と lint (shellcheck) を実行する。 +# shfmt -f が shebang と拡張子から script を検出するため、shell script を持たない +# リポジトリでは何も実行せず成功する (xargs -r)。全リポジトリへ安全に配信できる。 + +on: + push: + branches: [main] + pull_request: + branches: [main] + +# 既定では何も書き込ませない (最小権限)。checkout に必要な read のみ付与する。 +permissions: + contents: read + +jobs: + shell_lint: + name: shfmt & shellcheck + runs-on: ubuntu-24.04 + timeout-minutes: 5 + permissions: + contents: read + steps: + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + # lint 専用 job では認証情報を残す必要がない (最小権限)。 + persist-credentials: false + + # shellcheck は runner に同梱されているが shfmt は無いため go install で導入する。 + # version を固定して再現性を担保する。 + - name: Install shfmt + run: | + go install mvdan.cc/sh/v3/cmd/shfmt@v3.10.0 + echo "$(go env GOPATH)/bin" >> "${GITHUB_PATH}" + + # shfmt -f が shebang と拡張子から shell script を検出する。 + # これを唯一の検出源とし、整形差分があれば失敗する。 + - name: Check formatting (shfmt) + run: shfmt -f . | xargs -r -d '\n' shfmt -d + + # --external-sources で source 先 (bin/library/*.sh) を追跡し、 + # 呼び出し元込みの文脈で lint する。format が落ちても lint は実行する。 + - name: Lint (shellcheck) + if: ${{ !cancelled() }} + run: shfmt -f . | xargs -r -d '\n' shellcheck --external-sources