Logo Github Actions Centralized Reusable Workflows

Github Actions Centralized Reusable Workflows

Cộng đồng
selvarajmurugesan90
github-actions-centralized-reusable-workflows

Designs organization-level reusable GitHub Actions workflows (workflow_call) and shared composite actions hosted in a dedicated repo, so many repos call one standardized pipeline definition instead of duplicating workflow YAML. Use when the user asks to "centralize our GitHub Actions workflows," "create a reusable workflow with workflow_call," "enforce a standard CI pipeline across all repos," "version a shared composite action," or "reduce duplicated workflow YAML across the organization."

Tổng quan

Nhà phát hànhselvarajmurugesan90
Kho mãops-engineering-skills
Tên kỹ nănggithub-actions-centralized-reusable-workflows
Sao
44
Bản fork
18
Tệp đi kèm
Chỉ có hướng dẫn
Giấy phépApache-2.0
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI là Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • Đầy đủ trong hướng dẫn

    Mọi thứ mô hình cần đều nằm trong hướng dẫn — không có tệp bổ sung cần đồng bộ.

  • Mã nguồn mở

    Được selvarajmurugesan90 công bố trên GitHub. Hãy đọc nội dung nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Github Actions Centralized Reusable Workflows trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL thư mục kỹ năng bên dưới và xác nhận.
    https://github.com/selvarajmurugesan90/ops-engineering-skills/tree/main/plugins/cicd-tooling/skills/github-actions-centralized-reusable-workflows
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/selvarajmurugesan90/ops-engineering-skills.git /tmp/ops-engineering-skills
mkdir -p .claude/skills
cp -r /tmp/ops-engineering-skills/plugins/cicd-tooling/skills/github-actions-centralized-reusable-workflows .claude/skills/github-actions-centralized-reusable-workflows
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Github Actions Centralized Reusable Workflows trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự tải Github Actions Centralized Reusable Workflows ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên Github Actions Centralized Reusable Workflows không bị giới hạn ở mô hình mà kỹ năng này được viết cho. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên kỹ năng chưa dùng không tốn chi phí.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

GitHub Actions Centralized Reusable Workflows

Purpose

When the same workflow YAML — build, test, security scan, deploy — is copy-pasted across dozens of repos (github-actions-single-repo-workflows covers that per-repo pattern), a policy change (a new required scan, a registry migration) requires editing every repo individually and drifts immediately. GitHub Actions solves this at the organization level with reusable workflows (workflow_call), which let a caller workflow in any repo invoke one centrally-maintained workflow definition with inputs/ secrets, and shared composite actions hosted in a dedicated repo for smaller reusable step sequences. This skill covers designing, versioning, and rolling out that centralized pattern so many repos consume one standardized pipeline rather than diverging copies.

When to use

  • More than a handful of repos have near-identical .github/workflows/*.yml files and a change requires updating each one individually.
  • Standing up an organization-wide CI/CD standard (e.g. "every service repo must run this exact set of security gates before deploy") that individual teams shouldn't be able to silently drift from.
  • An existing reusable workflow needs a new input/secret, or a breaking change that must be versioned so callers can opt in on their own schedule.
  • Deciding whether a step sequence belongs in a per-repo composite action (see github-actions-single-repo-workflows) versus a centrally-hosted one consumed by many repos.
  • Migrating from Jenkins shared libraries to GitHub Actions and wanting the equivalent centralization model — compare with jenkins-centralized-shared-library.

Prerequisites & environment

  • A dedicated repository to host reusable workflows/composite actions (commonly .github at the org level for org-wide defaults, or a purpose-named repo like actions-library).
  • Organization (or repo, for repo-scoped reuse) admin access to configure which repos may call reusable workflows: Organization Settings → Actions → General → "Access" for reusable workflows and actions, since by default a private reusable workflow is only callable from repos in the same organization unless explicitly opened up.
  • Caller repos need permissions: granted appropriately, since a reusable workflow runs with the permissions the caller grants it, not its own hardcoded defaults.
  • Secrets: either passed explicitly via secrets: inherit (simplest, but passes everything the caller has) or named individually (secrets: { DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }} }, more auditable about exactly what the reusable workflow receives).
  • Semantic version tags (or at minimum SHA pinning discipline) on the reusable-workflow repo so callers can pin a version rather than track @main.

Step-by-step guidance

  1. Define the reusable workflow with workflow_call as its trigger, declaring explicit inputs: and secrets: — this is what makes it callable from another repo rather than only runnable in its own repo:

    yaml
    # .github/workflows/standard-node-ci.yml  (in org/actions-library)
    name: standard-node-ci
    on:
      workflow_call:
        inputs:
          node-version:
            type: string
            default: "20"
          deploy-target:
            type: string
            required: false
        secrets:
          DEPLOY_TOKEN:
            required: false
    jobs:
      test:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v4
          - uses: actions/setup-node@v4
            with: { node-version: ${{ inputs.node-version }}, cache: "npm" }
          - run: npm ci
          - run: npm test
    
      deploy:
        needs: test
        if: inputs.deploy-target != ''
        runs-on: ubuntu-latest
        environment: ${{ inputs.deploy-target }}
        steps:
          - run: ./deploy.sh ${{ inputs.deploy-target }}
            env:
              DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
  2. Call it from a consumer repo with a pinned version, keeping the caller workflow thin:

    yaml
    # .github/workflows/ci.yml  (in org/checkout-api)
    name: ci
    on:
      pull_request:
        branches: [main]
      push:
        branches: [main]
    jobs:
      ci:
        uses: org/actions-library/.github/workflows/standard-node-ci.yml@v1.3.0
        with:
          node-version: "20"
          deploy-target: staging
        secrets:
          DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }}

    Pin @v1.3.0 (a tag), not @main — the same versioning discipline as a Jenkins shared library (see jenkins-centralized-shared-library for the direct analog).

  3. Use secrets: inherit only when the caller repo's full secret set is genuinely intended for the reusable workflow — otherwise pass secrets explicitly by name so it's auditable exactly what a centrally-maintained workflow can access from each caller.

  4. Host smaller, non-workflow reusable pieces as composite actions in the same or a sibling repo, versioned the same way:

    yaml
    # org/actions-library/setup-node-env/action.yml
    name: "Setup Node env (org standard)"
    runs:
      using: "composite"
      steps:
        - uses: actions/setup-node@v4
          with: { node-version: "20", cache: "npm" }
        - run: npm ci
          shell: bash

    Consumed as:

    yaml
    - uses: org/actions-library/setup-node-env@v1.3.0
  5. Nest reusable workflows sparingly — GitHub Actions allows calling a reusable workflow from within another reusable workflow up to a depth limit (4 levels as of current GitHub Actions); design the org's standard workflows as a shallow, well-documented hierarchy rather than deep nesting that's hard to trace.

  6. Version and changelog the library repo deliberately: tag releases, document each inputs:/secrets: change, and treat removing or renaming an input as a breaking (major) change requiring caller migration, exactly like a public API.

  7. Roll out breaking changes gradually: cut a new major tag, migrate a few pilot repos to @v2.0.0, validate, then open individual PRs against the remaining caller repos to bump the pin — never silently rewrite the floating @main ref that other repos might still be depending on and never bulk-force-push changes into consumer repos' workflow files without their own review.

  8. Enforce adoption, don't just offer it, via a required organization ruleset or a periodic audit (e.g. a scheduled workflow that scans repos for .github/workflows/*.yml files that don't call the standard reusable workflow) if the goal is a hard organization-wide standard rather than an opt-in convenience.

Best practices

  • Pin callers to a tagged version (@v1.3.0) or full commit SHA, never @main, for the same reason third-party actions should be pinned — see github-actions-single-repo-workflows.
  • Keep the reusable workflow's inputs:/secrets: surface small and well-documented (a table in the library repo's README); every input should have a sensible default unless it's genuinely required.
  • Prefer named secrets: passing over secrets: inherit for anything security-sensitive, so an audit of the reusable workflow's YAML alone shows exactly what secrets it can touch.
  • Give the reusable-workflow repo its own tests: a workflow in that same repo that calls the reusable workflow against a throwaway/sample scenario on every change, so a broken reusable workflow is caught before a version tag goes out to every caller.
  • Grant the minimum permissions: needed in the caller workflow — a reusable workflow only gets the permissions the caller's job explicitly passes down, so scoping the caller tightly protects every repo that invokes the shared workflow.
  • Document a clear deprecation/migration path (a fixed window, e.g. 90 days) when retiring an old major version, mirroring the same discipline used for Jenkins shared library majors — see jenkins-centralized-shared-library.

Common pitfalls

  • Symptom: A caller repo's deploy step fails with "secret not found" even though the secret clearly exists in that repo's settings. Fix: Reusable workflows do not automatically inherit the caller's secrets — either add secrets: inherit at the call site, or pass the specific secret explicitly (secrets: { DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }} }); a workflow_call job with an undeclared secret input silently receives nothing.

  • Symptom: Updating the reusable workflow's main branch immediately changes behavior for every caller repo pinned to @main, breaking several simultaneously. Fix: This is the cost of unpinned callers; migrate all callers to pin an explicit version tag, and treat @main as for the library repo's own testing only, never as a supported caller reference.

  • Symptom: A private reusable workflow works when called from one repo but a different repo in the same org gets "workflow was not found" or an access-denied error. Fix: Check Organization Settings → Actions → General → Access for reusable workflows — a private reusable workflow's repo must explicitly allow access from the calling repo (or the org broadly), it is not automatically callable org-wide by default.

  • Symptom: Adding a new required input to the reusable workflow breaks every caller simultaneously the moment it merges. Fix: Give new inputs a default: value for a minor version so existing callers keep working unchanged; reserve genuinely required new inputs for a major version bump callers must opt into.

  • Symptom: Someone deletes an old reusable-workflow version tag or renames the hosting repo without checking who still references it, breaking pipelines across the org simultaneously with no warning. Fix: Before deleting a version tag or moving/renaming the actions-library repo, search caller repos (e.g. a GitHub code search for uses: org/actions-library/.github/workflows/standard-node-ci.yml@v1) for references still pinned to that tag/path — treat this the same as the "don't delete a still-referenced Jenkins shared library version" warning in jenkins-centralized-shared-library.

Worked example

Scenario: An organization has 40 Node.js service repos, each duplicating a nearly-identical CI/CD workflow. They centralize into one reusable workflow so each repo's caller file is ~10 lines, and adding a new required security scan later needs only one PR to the library repo plus each caller bumping its version pin.

org/actions-library/.github/workflows/standard-node-ci.yml (excerpt adding a scan stage in v1.4.0):

yaml
on:
  workflow_call:
    inputs:
      node-version: { type: string, default: "20" }
    secrets:
      DEPLOY_TOKEN: { required: false }
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with: { node-version: ${{ inputs.node-version }}, cache: "npm" }
      - run: npm ci && npm test

  security-scan:
    needs: test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: aquasecurity/trivy-action@0.24.0
        with: { scan-type: 'fs', severity: 'CRITICAL,HIGH', exit-code: '1' }

  deploy:
    needs: security-scan
    if: github.ref == 'refs/heads/main'
    runs-on: ubuntu-latest
    environment: staging
    steps:
      - run: ./deploy.sh staging
        env: { DEPLOY_TOKEN: "${{ secrets.DEPLOY_TOKEN }}" }

Caller repo (org/checkout-api/.github/workflows/ci.yml), unchanged except bumping the version pin when ready to adopt the new scan stage:

yaml
name: ci
on:
  pull_request: { branches: [main] }
  push: { branches: [main] }
jobs:
  ci:
    uses: org/actions-library/.github/workflows/standard-node-ci.yml@v1.4.0
    with: { node-version: "20" }
    secrets:
      DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }}

Each of the 40 repos bumps @v1.3.0 → @v1.4.0 on its own schedule via a one-line PR, instead of 40 separate workflow-file rewrites to add the security-scan job.

Cross-references

Câu hỏi thường gặp

Kỹ năng AI Github Actions Centralized Reusable Workflows làm được gì?

Designs organization-level reusable GitHub Actions workflows (workflow_call) and shared composite actions hosted in a dedicated repo, so many repos call one standardized pipeline definition instead of duplicating workflow YAML. Use when the user asks to "centralize our GitHub Actions workflows," "create a reusable workflow with workflow_call," "enforce a standard CI pipeline across all repos," "version a shared composite action," or "reduce duplicated workflow YAML across the organization."

Vì sao nên dùng Github Actions Centralized Reusable Workflows trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Github Actions Centralized Reusable Workflows là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Github Actions Centralized Reusable Workflows trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/selvarajmurugesan90/ops-engineering-skills/tree/main/plugins/cicd-tooling/skills/github-actions-centralized-reusable-workflows. TypingMind đọc tệp SKILL.md và cài đặt thành một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Github Actions Centralized Reusable Workflows?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Bạn có thể dùng Github Actions Centralized Reusable Workflows với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Github Actions Centralized Reusable Workflows với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Github Actions Centralized Reusable Workflows có miễn phí không?

Có. Kỹ năng này được selvarajmurugesan90 phát hành trên GitHub theo giấy phép Apache-2.0. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp cho mô hình các công cụ mới để gọi — mã được chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và tiêu chí của đầu ra tốt. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇