Merge pull request #2845 from Adobe-Enterprise-Docs/UGP-15509 #72
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: Mirror | ||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| jobs: | ||
| # This single caller file lives in EN and LOC repos under the SAME path | ||
| # (.github/workflows/mirror.yml), so its content must be identical everywhere. | ||
| # It routes to the correct reusable workflow based on the repo name suffix: | ||
| # *.en -> mirror-to-public.yml (no localized asset injection) | ||
| # *.<lang>-<reg> -> mirror-to-public-localized.yml (injects assign-issue/assign-pr) | ||
| # | ||
| # NOTE: GitHub Actions does NOT allow expressions (${{ }}) in a job's `uses:`, so the | ||
| # workflow path cannot be chosen dynamically inside one job. Instead we use two | ||
| # mutually-exclusive caller jobs gated by `if:`, plus a `detect` job that parses the | ||
| # repo name to decide the route and derive the locale team slug. | ||
| detect: | ||
| # Skip on the public AdobeDocs mirror: this file gets mirrored along with the rest | ||
| # of the tree, but it must only run in the source org, never on the public copy | ||
| # where it would attempt to mirror onto itself. | ||
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository_owner == 'Adobe-Enterprise-Docs' | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| is_en: ${{ steps.route.outputs.is_en }} | ||
| locale: ${{ steps.route.outputs.locale }} | ||
| team_slug: ${{ steps.route.outputs.team_slug }} | ||
| steps: | ||
| - name: Determine route from repo name | ||
| id: route | ||
| env: | ||
| REPO_NAME: ${{ github.event.repository.name }} | ||
| run: | | ||
| set -euo pipefail | ||
| # Examples: "analytics.en" -> "en"; "analytics.de-DE" -> "de-de". | ||
| locale="${REPO_NAME##*.}" | ||
| locale="$(echo "$locale" | tr '[:upper:]' '[:lower:]')" | ||
| echo "locale=${locale}" >> "$GITHUB_OUTPUT" | ||
| if [ "$locale" = "en" ]; then | ||
| # EN repos mirror without localized asset injection, so no team slug is needed. | ||
| echo "is_en=true" >> "$GITHUB_OUTPUT" | ||
| echo "team_slug=" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "is_en=false" >> "$GITHUB_OUTPUT" | ||
| echo "team_slug=sccm-loc-vendors-${locale}" >> "$GITHUB_OUTPUT" | ||
| fi | ||
| mirror-en: | ||
| needs: detect | ||
| if: needs.detect.outputs.is_en == 'true' | ||
| uses: Adobe-Enterprise-Docs/workflows/.github/workflows/mirror-to-public.yml@main | ||
|
Check failure on line 53 in .github/workflows/mirror.yml
|
||
| secrets: inherit | ||
| mirror-loc: | ||
| needs: detect | ||
| if: needs.detect.outputs.is_en == 'false' | ||
| uses: Adobe-Enterprise-Docs/workflows/.github/workflows/mirror-to-public-localized.yml@main | ||
| secrets: inherit | ||
| with: | ||
| # Locale team slug is derived from the repo name suffix (e.g. *.de-de -> sccm-loc-vendors-de-de), | ||
| # replacing __TEAM_SLUG__ in the shared assign-issue.yml / assign-pr.yml templates. | ||
| locale-team-slug: ${{ needs.detect.outputs.team_slug }} | ||