Update sync-standards-global.json #130
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: 🎛️ Workflow Controller | |
| on: | |
| push: | |
| branches: [ '**' ] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| packages: write | |
| id-token: write | |
| jobs: | |
| # ---------------------------------------- | |
| # 🧩 Precheck | |
| # ---------------------------------------- | |
| precheck: | |
| name: 🧮 Precheck | |
| if: ${{ !endsWith(github.repository, '/.github') }} | |
| # Org repos → self-hosted, user repos → github-hosted | |
| runs-on: ${{ github.event.repository.owner.type == 'Organization' && 'self-hosted' || 'ubuntu-latest' }} | |
| timeout-minutes: 3 | |
| continue-on-error: true | |
| outputs: | |
| over_limit: ${{ steps.usage.outputs.over_limit || steps.assume_ok.outputs.over_limit || 'false' }} | |
| steps: | |
| - name: 🔎 Owner info (debug) | |
| run: | | |
| echo "Repository: ${{ github.repository }}" | |
| echo "Owner: ${{ github.repository_owner }}" | |
| echo "Owner type: ${{ github.event.repository.owner.type }}" | |
| echo "Runner: $RUNNER_NAME" | |
| echo "Runner OS: $RUNNER_OS" | |
| - name: 🧾 Minimal Checkout for Local Actions | |
| uses: actions/checkout@v4 | |
| with: | |
| sparse-checkout: | | |
| .github/actions | |
| .github/scripts | |
| fetch-depth: 1 | |
| # Only needed (and only valid) for org repos | |
| - name: ⚙️ Validate GH_TOKEN | |
| if: ${{ github.event.repository.owner.type == 'Organization' }} | |
| uses: ./.github/actions/validate-gh-token | |
| with: | |
| gh-token: ${{ secrets.GH_TOKEN }} | |
| - name: 🧮 Check GitHub Usage (org only) | |
| id: usage | |
| if: ${{ github.event.repository.owner.type == 'Organization' }} | |
| uses: ./.github/actions/check-org-usage | |
| with: | |
| gh-token: ${{ secrets.GH_TOKEN }} | |
| org-name: ${{ github.repository_owner }} | |
| check-actions: "true" | |
| check-packages-bandwidth: "false" | |
| # For user repos, we don't care about org minutes at all | |
| - name: ✅ Assume under limit (user repos) | |
| id: assume_ok | |
| if: ${{ github.event.repository.owner.type != 'Organization' }} | |
| run: | | |
| echo "This is a user-owned repo; skipping org usage checks." | |
| echo "over_limit=false" >> "$GITHUB_OUTPUT" | |
| - name: 📊 Summary | |
| run: | | |
| echo "Precheck complete." | |
| echo "Owner type: ${{ github.event.repository.owner.type }}" | |
| echo "over_limit = ${{ steps.usage.outputs.over_limit || steps.assume_ok.outputs.over_limit || 'false' }}" | |
| - name: 🧹 Cleanup Runner | |
| if: always() | |
| uses: ./.github/actions/cleanup-runner | |
| # ---------------------------------------- | |
| # 🔍 Analyze repo / commit to decide what to run | |
| # ---------------------------------------- | |
| analyze: | |
| name: ${{ format('🔍 Analyze {0}', needs.precheck.outputs.over_limit == 'true' && '(Self-Hosted)' || '(GitHub)') }} | |
| if: ${{ !endsWith(github.repository, '/.github') }} | |
| needs: precheck | |
| runs-on: ${{ needs.precheck.outputs.over_limit == 'true' && 'self-hosted' || 'ubuntu-latest' }} | |
| timeout-minutes: 5 | |
| outputs: | |
| run_compile: ${{ steps.check.outputs.run_compile }} | |
| run_publish_package: ${{ steps.check.outputs.run_publish_package }} | |
| run_publish_bot: ${{ steps.check.outputs.run_publish_bot }} | |
| run_publish_zip: ${{ steps.check.outputs.run_publish_zip }} | |
| has_compile: ${{ steps.check.outputs.has_compile }} | |
| has_publish_package: ${{ steps.check.outputs.has_publish_package }} | |
| has_publish_bot: ${{ steps.check.outputs.has_publish_bot }} | |
| has_publish_zip: ${{ steps.check.outputs.has_publish_zip }} | |
| steps: | |
| - name: 🧾 Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 2 | |
| - name: 🔍 Analyze commit message, branch, and file changes | |
| id: check | |
| shell: bash | |
| run: | | |
| # Get branch from ref | |
| branch="${GITHUB_REF##*/}" | |
| # Safely get full commit message from git | |
| msg="$(git log -1 --pretty=%B)" | |
| echo "Branch: $branch" | |
| echo "Commit message:" | |
| printf '%s\n' "$msg" | |
| # defaults | |
| echo "run_compile=false" >> $GITHUB_OUTPUT | |
| echo "run_publish_package=false" >> $GITHUB_OUTPUT | |
| echo "run_publish_bot=false" >> $GITHUB_OUTPUT | |
| echo "run_publish_zip=false" >> $GITHUB_OUTPUT | |
| # skip CI completely | |
| if [[ "$msg" == *"[skip ci]"* ]]; then | |
| echo "Detected [skip ci]; exiting early." | |
| exit 0 | |
| fi | |
| # ---------------------------------------- | |
| # 🔧 Code-related file filters | |
| # ---------------------------------------- | |
| CODE_FILTERS=( | |
| # C# | |
| '\.cs$' | |
| '\.csproj$' | |
| '\.sln$' | |
| '\.targets$' | |
| 'Directory\.Build\.' | |
| # C/C++ | |
| '\.c$' | |
| '\.cc$' | |
| '\.cpp$' | |
| '\.cxx$' | |
| '\.h$' | |
| '\.hh$' | |
| '\.hpp$' | |
| '\.hxx$' | |
| '\.inl$' | |
| '\.vcxproj$' | |
| '\.vcxproj\.filters$' | |
| '\.props$' | |
| ) | |
| # ---------------------------------------- | |
| git diff --name-only HEAD~1 > changed.txt || true | |
| echo "Changed files:" | |
| cat changed.txt || echo "(none)" | |
| pattern="${CODE_FILTERS[*]}" | |
| if grep -E "${pattern// /|}" changed.txt >/dev/null 2>&1; then | |
| echo "Detected matching code file → compile enabled." | |
| echo "run_compile=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "No matching code changes → skipping compile." | |
| echo "run_compile=false" >> $GITHUB_OUTPUT | |
| fi | |
| # ---------------------------------------- | |
| # Publish triggers (package / bot / zip) | |
| # ---------------------------------------- | |
| if [[ "$branch" == "main" || "$branch" == "master" || "$branch" == release/* ]]; then | |
| # Package | |
| if [[ "$msg" == *"[publish-package]"* || "$msg" == *"[publishpackage]"* ]]; then | |
| echo "run_publish_package=true" >> $GITHUB_OUTPUT | |
| fi | |
| # Bot | |
| if [[ "$msg" == *"[publish-bot]"* || "$msg" == *"[publishbot]"* ]]; then | |
| echo "run_publish_bot=true" >> $GITHUB_OUTPUT | |
| fi | |
| # Zip | |
| if [[ "$msg" == *"[publish-zip]"* || "$msg" == *"[publishzip]"* ]]; then | |
| echo "run_publish_zip=true" >> $GITHUB_OUTPUT | |
| fi | |
| else | |
| echo "Branch '$branch' not eligible for publish/package/bot/zip." | |
| fi | |
| # detect workflow existence | |
| [[ -f ".github/workflows/compile.yml" ]] && echo "has_compile=true" >> $GITHUB_OUTPUT || echo "has_compile=false" >> $GITHUB_OUTPUT | |
| [[ -f ".github/workflows/publish-package.yml" ]] && echo "has_publish_package=true" >> $GITHUB_OUTPUT || echo "has_publish_package=false" >> $GITHUB_OUTPUT | |
| [[ -f ".github/workflows/publish-bot.yml" ]] && echo "has_publish_bot=true" >> $GITHUB_OUTPUT || echo "has_publish_bot=false" >> $GITHUB_OUTPUT | |
| [[ -f ".github/workflows/publish-zip.yml" ]] && echo "has_publish_zip=true" >> $GITHUB_OUTPUT || echo "has_publish_zip=false" >> $GITHUB_OUTPUT | |
| - name: 🧠 Summary | |
| run: | | |
| echo "------------------------------------------" | |
| echo "🧠 Workflow Controller Summary" | |
| echo "------------------------------------------" | |
| echo "Repository: ${{ github.repository }}" | |
| echo "Branch: ${GITHUB_REF##*/}" | |
| echo "Compile: ${{ steps.check.outputs.run_compile }} (exists: ${{ steps.check.outputs.has_compile }})" | |
| echo "Publish-Pkg: ${{ steps.check.outputs.run_publish_package }} (exists: ${{ steps.check.outputs.has_publish_package }})" | |
| echo "Publish-Bot: ${{ steps.check.outputs.run_publish_bot }} (exists: ${{ steps.check.outputs.has_publish_bot }})" | |
| echo "Publish-Zip: ${{ steps.check.outputs.run_publish_zip }} (exists: ${{ steps.check.outputs.has_publish_zip }})" | |
| echo "------------------------------------------" | |
| - name: 🧹 Cleanup Runner | |
| if: always() | |
| uses: ./.github/actions/cleanup-runner | |
| # ---------------------------------------- | |
| # ⚙️ Compile | |
| # ---------------------------------------- | |
| compile: | |
| name: ⚙️ (${{ matrix.configuration }}) | |
| if: ${{ !endsWith(github.repository, '/.github') && | |
| needs.analyze.outputs.run_compile == 'true' && | |
| needs.analyze.outputs.has_compile == 'true' }} | |
| needs: analyze | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| configuration: [ Debug, Release ] | |
| uses: ./.github/workflows/compile.yml | |
| with: | |
| # if you ever want to pass a specific project/pattern from analyze, you can add: | |
| # project: ${{ needs.analyze.outputs.project }} | |
| # project_pattern: ${{ needs.analyze.outputs.project_pattern }} | |
| configuration: ${{ matrix.configuration }} | |
| secrets: inherit | |
| # ---------------------------------------- | |
| # 📦 Package (NuGet / etc.) | |
| # ---------------------------------------- | |
| publish-package: | |
| name: 📦 | |
| if: ${{ !endsWith(github.repository, '/.github') && | |
| needs.analyze.outputs.run_publish_package == 'true' && | |
| needs.analyze.outputs.has_publish_package == 'true' }} | |
| needs: analyze | |
| # Prefer new filename; keep compatibility with old publish.yml if you still have some | |
| uses: ./.github/workflows/publish-package.yml | |
| secrets: inherit | |
| # ---------------------------------------- | |
| # 🤖 Bot-specific publish | |
| # ---------------------------------------- | |
| publish-bot: | |
| name: 🤖 | |
| if: ${{ !endsWith(github.repository, '/.github') && | |
| needs.analyze.outputs.run_publish_bot == 'true' && | |
| needs.analyze.outputs.has_publish_bot == 'true' }} | |
| needs: analyze | |
| uses: ./.github/workflows/publish-bot.yml | |
| secrets: inherit | |
| # ---------------------------------------- | |
| # 🗜️ Zip-based release (full repo archive) | |
| # ---------------------------------------- | |
| publish-zip: | |
| name: 🗜️ | |
| if: ${{ !endsWith(github.repository, '/.github') && | |
| needs.analyze.outputs.run_publish_zip == 'true' && | |
| needs.analyze.outputs.has_publish_zip == 'true' }} | |
| needs: analyze | |
| uses: ./.github/workflows/publish-zip.yml | |
| secrets: inherit |