[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M73BPWGGDSZWK1B0B84KN82Z":3,"skill-same:01M73BPWGGDSZWK1B0B84KN82Z":53},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":29,"commitSha":30,"skillDirectory":31,"forksCount":32,"repositoryHtmlUrl":33,"repositoryHomepageUrl":34,"ownerHtmlUrl":35,"ownerBlogUrl":36,"ownerDescription":37,"updatedAt":38,"install":39,"resources":52},"01M73BPWGGDSZWK1B0B84KN82Z","github-actions-advanced",null,"Design, debug, and harden GitHub Actions CI\u002FCD workflows, including reusable workflows, matrix builds, self-hosted runners, OIDC authentication, caching, environments, secrets, and release automation.","Horonomos-laps\u002FYana-AI","Horonomos-laps","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F355299122?v=4","01M76B3QPXE88ET2SQPDPVATZT"," Horonomos-laps","01M72ZQRJPCYPSSWT4D00VJR2A",13,"Apache-2.0","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002Fcore\u002Fskills\u002Fgithub-actions-advanced\u002FSKILL.md",[],[],"2026-11-11 15:11:14",false,"---\nname: github-actions-advanced\ndescription: >\n  Design, debug, and harden GitHub Actions CI\u002FCD workflows, including reusable\n  workflows, matrix builds, self-hosted runners, OIDC authentication, caching,\n  environments, secrets, and release automation.\ncategory: devops\nrisk: safe\nsource: community\ndate_added: \"2026-05-30\"\n---\n\n# GitHub Actions Advanced Skill\n\nExpert guidance for designing, writing, debugging, and securing **production-grade** GitHub Actions workflows.\n\n---\n\n## When to Use This Skill\n\n- User mentions GitHub Actions, `.github\u002Fworkflows`, CI\u002FCD pipelines, runners, jobs, steps, or actions\n- User wants to automate builds, tests, deployments, or releases via GitHub\n- User asks about matrix builds, reusable workflows, composite actions, or self-hosted runners\n- User needs help with OIDC authentication, caching strategies, or secrets management\n- User says \"my GitHub pipeline is failing\" or \"set up CI for my repo\"\n- User asks about workflow security, hardening, or environment protection rules\n\n## When NOT to Use This Skill\n\n- The user is working with GitLab CI\u002FCD → recommend `gitlab-ci-patterns`\n- The user is working with CircleCI, Jenkins, or other CI platforms\n- The task is purely about Docker image building without GitHub context → recommend `docker-expert`\n- The task is about Kubernetes deployment configuration → recommend `kubernetes-architect`\n\n---\n\n## Step 1: Understand Context Before Responding\n\nWhen invoked, first gather context:\n\n```bash\n# Discover existing workflows in the repo\nfind .github\u002Fworkflows -name \"*.yml\" -o -name \"*.yaml\" 2>\u002Fdev\u002Fnull | head -20\n\n# Check for composite actions\nfind .github\u002Factions -name \"action.yml\" 2>\u002Fdev\u002Fnull\n\n# Detect tech stack (influences runner OS, language setup actions)\nls package.json requirements.txt Gemfile go.mod Cargo.toml pom.xml 2>\u002Fdev\u002Fnull\n```\n\nThen adapt recommendations to:\n- Existing workflow patterns in the repo\n- The tech stack and language runtime\n- Whether this is a monorepo or single-project repo\n- Whether self-hosted or GitHub-hosted runners are in use\n\n---\n\n## Workflow Structure Reference\n\n```yaml\nname: Workflow Name\n\non:                          # Triggers (see Triggers section)\n  push:\n    branches: [main]\n\npermissions:                 # Always declare — principle of least privilege\n  contents: read\n\nenv:                         # Workflow-level env vars\n  NODE_VERSION: '20'\n\nconcurrency:                 # Prevent duplicate runs\n  group: ${{ github.workflow }}-${{ github.ref }}\n  cancel-in-progress: true   # Cancel older runs for same branch\n\njobs:\n  job-id:\n    name: Human-readable name\n    runs-on: ubuntu-24.04    # Pin OS version — never use -latest in prod\n    timeout-minutes: 15      # Always set — prevents runaway jobs\n    environment: production  # Links to GitHub Environment (approvals\u002Fsecrets)\n\n    steps:\n      - uses: actions\u002Fcheckout@11bd71901bbe5b1630ceea73d27597364c9af683  # v4.2.2\n      - name: Step name\n        run: echo \"hello\"\n```\n\n---\n\n## Triggers (`on:`)\n\n### Common Patterns\n\n```yaml\non:\n  push:\n    branches: [main, 'release\u002F**']\n    paths-ignore: ['**.md', 'docs\u002F**']   # Skip docs-only changes\n\n  pull_request:\n    types: [opened, synchronize, reopened]\n    branches: [main]\n\n  workflow_dispatch:                      # Manual trigger with inputs\n    inputs:\n      environment:\n        description: 'Deploy target'\n        required: true\n        type: choice\n        options: [staging, production]\n      dry-run:\n        description: 'Dry run only?'\n        type: boolean\n        default: false\n\n  schedule:\n    - cron: '0 2 * * 1'                 # Monday 2am UTC\n\n  workflow_call:                          # Called by other workflows (reusable)\n    inputs:\n      image-tag:\n        type: string\n        required: true\n    secrets:\n      deploy-token:\n        required: true\n\n  release:\n    types: [published]                   # Trigger only on published releases\n\n  pull_request_target:                   # Runs with repo secrets — use with care!\n    types: [labeled]                     # Gate with label + author_association check\n```\n\n> **Security Warning:** `pull_request_target` runs with repo secrets. Only use after a maintainer labels the PR. Never check out fork code without explicit sandboxing.\n\n---\n\n## Reusable Workflows\n\nSplit large pipelines into composable units stored in `.github\u002Fworkflows\u002F`.\n\n**Convention:** Prefix internal\u002Freusable workflows with `_` (e.g., `_build.yml`).\n\n### Caller (`.github\u002Fworkflows\u002Fdeploy.yml`)\n\n```yaml\njobs:\n  call-build:\n    uses: .\u002F.github\u002Fworkflows\u002F_build.yml        # Same-repo reusable\n    # uses: org\u002Frepo\u002F.github\u002Fworkflows\u002Fbuild.yml@main  # Cross-repo\n    with:\n      image-tag: ${{ github.sha }}\n    secrets: inherit                             # Pass all caller secrets down\n  \n  call-test:\n    uses: .\u002F.github\u002Fworkflows\u002F_test.yml\n    with:\n      node-version: '20'\n    secrets:\n      NPM_TOKEN: ${{ secrets.NPM_TOKEN }}       # Explicit secret passing\n```\n\n### Reusable Workflow (`.github\u002Fworkflows\u002F_build.yml`)\n\n```yaml\non:\n  workflow_call:\n    inputs:\n      image-tag:\n        type: string\n        required: true\n      push:\n        type: boolean\n        default: false\n    secrets:\n      registry-token:\n        required: false\n    outputs:\n      digest:\n        description: \"Image digest\"\n        value: ${{ jobs.build.outputs.digest }}\n\njobs:\n  build:\n    runs-on: ubuntu-24.04\n    timeout-minutes: 20\n    outputs:\n      digest: ${{ steps.build.outputs.digest }}\n    steps:\n      - uses: actions\u002Fcheckout@11bd71901bbe5b1630ceea73d27597364c9af683  # v4.2.2\n      - id: build\n        uses: docker\u002Fbuild-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75  # v6.9.0\n        with:\n          push: ${{ inputs.push }}\n          tags: myapp:${{ inputs.image-tag }}\n```\n\n---\n\n## Matrix Builds\n\n```yaml\njobs:\n  test:\n    strategy:\n      fail-fast: false           # Don't cancel others if one fails\n      max-parallel: 4            # Limit concurrent runners\n      matrix:\n        os: [ubuntu-24.04, windows-2022, macos-14]\n        node: ['18', '20', '22']\n        exclude:\n          - os: windows-2022\n            node: '18'\n        include:\n          - os: ubuntu-24.04\n            node: '22'\n            experimental: true   # Custom matrix variable\n\n    runs-on: ${{ matrix.os }}\n    timeout-minutes: 20\n\n    steps:\n      - uses: actions\u002Fcheckout@11bd71901bbe5b1630ceea73d27597364c9af683  # v4.2.2\n      - uses: actions\u002Fsetup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af  # v4.1.0\n        with:\n          node-version: ${{ matrix.node }}\n          cache: 'npm'\n      - run: npm ci\n      - run: npm test\n        continue-on-error: ${{ matrix.experimental == true }}\n```\n\n### Dynamic Matrix via Script\n\n```yaml\njobs:\n  generate-matrix:\n    runs-on: ubuntu-24.04\n    outputs:\n      matrix: ${{ steps.set-matrix.outputs.matrix }}\n    steps:\n      - uses: actions\u002Fcheckout@11bd71901bbe5b1630ceea73d27597364c9af683  # v4.2.2\n      - id: set-matrix\n        run: |\n          SERVICES=$(find services -mindepth 1 -maxdepth 1 -type d -printf '%f\\n' | jq -R -s -c 'split(\"\\n\")[:-1]')\n          printf 'matrix={\"service\":%s}\\n' \"$SERVICES\" >> \"$GITHUB_OUTPUT\"\n\n  build:\n    needs: generate-matrix\n    strategy:\n      matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}\n    runs-on: ubuntu-24.04\n    steps:\n      - env:\n          SERVICE: ${{ matrix.service }}\n        run: echo \"Building $SERVICE\"\n```\n\n---\n\n## Caching Strategies\n\n### Language Setup Actions (Preferred — No Extra Step Needed)\n\n```yaml\n# Node.js\n- uses: actions\u002Fsetup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af  # v4.1.0\n  with:\n    node-version: '20'\n    cache: 'npm'           # or 'yarn' or 'pnpm'\n\n# Python\n- uses: actions\u002Fsetup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b  # v5.3.0\n  with:\n    python-version: '3.12'\n    cache: 'pip'\n\n# Go\n- uses: actions\u002Fsetup-go@3041bf56c941b39c61721a86cd11f3bb1338122a  # v5.2.0\n  with:\n    go-version: '1.23'\n    cache: true\n\n# Java \u002F Gradle \u002F Maven\n- uses: actions\u002Fsetup-java@7a6d8a8234af8eb26422e24052f73b12b0e46a27  # v4.6.0\n  with:\n    distribution: 'temurin'\n    java-version: '21'\n    cache: 'maven'        # or 'gradle'\n```\n\n### Manual Cache (Any Tool)\n\n```yaml\n- uses: actions\u002Fcache@6849a6489940f00c2f30c0fb92c6274307ccb58a  # v4.1.2\n  id: cache-deps\n  with:\n    path: |\n      ~\u002F.cache\u002Fpip\n      .venv\n    key: ${{ runner.os }}-pip-${{ hashFiles('**\u002Frequirements*.txt') }}\n    restore-keys: |\n      ${{ runner.os }}-pip-${{ hashFiles('**\u002Frequirements*.txt') }}\n      ${{ runner.os }}-pip-\n\n- name: Install deps (only on cache miss)\n  if: steps.cache-deps.outputs.cache-hit != 'true'\n  run: pip install -r requirements.txt\n```\n\n### Docker Layer Caching\n\n```yaml\n- uses: docker\u002Fbuild-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75  # v6.9.0\n  with:\n    cache-from: type=gha\n    cache-to: type=gha,mode=max\n    # For registry-backed cache (cross-branch):\n    # cache-from: type=registry,ref=ghcr.io\u002Fmyorg\u002Fmyapp:buildcache\n    # cache-to: type=registry,ref=ghcr.io\u002Fmyorg\u002Fmyapp:buildcache,mode=max\n```\n\n---\n\n## OIDC Authentication (Keyless Cloud Auth)\n\n**Never store long-lived cloud credentials as secrets.** Use OIDC to get short-lived tokens that expire automatically.\n\n### AWS\n\n```yaml\npermissions:\n  id-token: write\n  contents: read\n\nsteps:\n  - uses: aws-actions\u002Fconfigure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502  # v4.0.2\n    with:\n      role-to-assume: arn:aws:iam::123456789012:role\u002FGitHubActionsRole\n      aws-region: us-east-1\n      role-session-name: GitHubActions-${{ github.run_id }}\n\n  # Trust policy on the IAM role must include:\n  # \"token.actions.githubusercontent.com\" as OIDC provider\n  # Condition: \"repo:org\u002Frepo:ref:refs\u002Fheads\u002Fmain\" (restrict to branch)\n```\n\n### GCP (Workload Identity Federation)\n\n```yaml\npermissions:\n  id-token: write\n  contents: read\n\nsteps:\n  - uses: google-github-actions\u002Fauth@6fc4af4b145ae7821d527454aa9bd537d1f2dc5f  # v2.1.7\n    with:\n      workload_identity_provider: projects\u002F123456789\u002Flocations\u002Fglobal\u002FworkloadIdentityPools\u002Fgithub-pool\u002Fproviders\u002Fgithub-provider\n      service_account: github-actions@my-project.iam.gserviceaccount.com\n      token_format: access_token   # or 'id_token'\n```\n\n### Azure (Federated Identity)\n\n```yaml\npermissions:\n  id-token: write\n  contents: read\n\nsteps:\n  - uses: azure\u002Flogin@a65d910e8af852a8061c627c456678983e180302  # v2.2.0\n    with:\n      client-id: ${{ secrets.AZURE_CLIENT_ID }}\n      tenant-id: ${{ secrets.AZURE_TENANT_ID }}\n      subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}\n      # No client secret needed! Uses OIDC federated credentials\n```\n\n---\n\n## Environments & Deployment Protection\n\n```yaml\njobs:\n  deploy-staging:\n    environment:\n      name: staging\n      url: https:\u002F\u002Fstaging.myapp.com\n    runs-on: ubuntu-24.04\n    timeout-minutes: 30\n    steps:\n      - run: .\u002Fscripts\u002Fdeploy.sh staging\n\n  deploy-production:\n    needs: deploy-staging\n    environment:\n      name: production\n      url: https:\u002F\u002Fmyapp.com      # Shown in the GitHub UI deployment panel\n    runs-on: ubuntu-24.04\n    timeout-minutes: 30\n    steps:\n      - run: .\u002Fscripts\u002Fdeploy.sh production\n```\n\n**Configure in Settings → Environments:**\n- **Required reviewers** — manual approval gate before run\n- **Wait timer** — delay after approval (e.g., 10-minute buffer)\n- **Branch\u002Ftag restrictions** — only `main` or `v*` tags can deploy to prod\n- **Environment-specific secrets** — override repo-level secrets per environment\n- **Deployment branches** — whitelist which branches can target this environment\n\n---\n\n## Secrets Management\n\n```yaml\n# Access repo\u002Forg\u002Fenvironment secrets\nenv:\n  DB_PASSWORD: ${{ secrets.DB_PASSWORD }}\n\n# Auto-provided token — no setup needed\n- uses: actions\u002Fgithub-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea  # v7.0.1\n  with:\n    github-token: ${{ secrets.GITHUB_TOKEN }}\n\n# Hierarchy (most specific wins):\n# environment secret > repo secret > org secret\n```\n\n### Masking Dynamic Values\n\n```yaml\n- name: Generate and mask dynamic token\n  run: |\n    TOKEN=$(.\u002Fscripts\u002Fgenerate-token.sh)\n    echo \"::add-mask::$TOKEN\"          # Mask in all subsequent logs\n    echo \"DEPLOY_TOKEN=$TOKEN\" >> $GITHUB_ENV\n```\n\n### Secrets in Composite Actions\n\n```yaml\n# Secrets cannot be passed as inputs to composite actions\n# Pass them as env vars instead:\n- uses: .\u002F.github\u002Factions\u002Fmy-action\n  env:\n    SECRET_VALUE: ${{ secrets.MY_SECRET }}\n```\n\n---\n\n## Composite Actions\n\nPackage reusable step sequences into local actions. No container spin-up, no separate workflow file needed.\n\n### Action Definition (`.github\u002Factions\u002Fsetup-app\u002Faction.yml`)\n\n```yaml\nname: Setup App\ndescription: Install and configure application dependencies\n\ninputs:\n  node-version:\n    description: 'Node.js version'\n    required: false\n    default: '20'\n  install-flags:\n    description: 'Additional npm install flags'\n    required: false\n    default: ''\n\noutputs:\n  cache-hit:\n    description: 'Whether the dependency cache was hit'\n    value: ${{ steps.cache.outputs.cache-hit }}\n\nruns:\n  using: composite\n  steps:\n    - uses: actions\u002Fsetup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af  # v4.1.0\n      with:\n        node-version: ${{ inputs.node-version }}\n        cache: npm\n\n    - id: cache\n      uses: actions\u002Fcache@6849a6489940f00c2f30c0fb92c6274307ccb58a  # v4.1.2\n      with:\n        path: node_modules\n        key: ${{ runner.os }}-node-${{ inputs.node-version }}-${{ hashFiles('package-lock.json') }}\n\n    - name: Install dependencies\n      if: steps.cache.outputs.cache-hit != 'true'\n      shell: bash\n      env:\n        INSTALL_FLAGS: ${{ inputs.install-flags }}\n      run: |\n        args=()\n        case \"$INSTALL_FLAGS\" in\n          \"\") ;;\n          \"--ignore-scripts\") args+=(--ignore-scripts) ;;\n          *) echo \"Unsupported install flags\" >&2; exit 1 ;;\n        esac\n        npm ci \"${args[@]}\"\n\n    - name: Build\n      shell: bash\n      run: npm run build\n```\n\n### Usage in a Workflow\n\n```yaml\nsteps:\n  - uses: actions\u002Fcheckout@11bd71901bbe5b1630ceea73d27597364c9af683  # v4.2.2\n  - uses: .\u002F.github\u002Factions\u002Fsetup-app\n    with:\n      node-version: '22'\n      install-flags: '--ignore-scripts'\n```\n\n---\n\n## Self-Hosted Runners\n\n```yaml\njobs:\n  build-gpu:\n    runs-on: [self-hosted, linux, x64, gpu]    # Label matching\n    timeout-minutes: 60\n\n  build-arm:\n    runs-on: [self-hosted, linux, arm64]\n```\n\n### Runner Best Practices\n\n| Practice | Details |\n|---|---|\n| **Ephemeral runners** | Use Actions Runner Controller (ARC) on Kubernetes for fresh runners per job |\n| **Isolation** | Never share prod runners with untrusted\u002Ffork PR workflows |\n| **Cleanup hooks** | Set `ACTIONS_RUNNER_HOOK_JOB_COMPLETED` to reset environment |\n| **Runner groups** | Use groups to restrict which repos\u002Fworkflows can access which runners |\n| **Labels** | Use custom labels (e.g., `gpu`, `high-memory`) for precise targeting |\n| **Security** | Disable fork PR access to self-hosted runners in Settings |\n\n```bash\n# Actions Runner Controller (Kubernetes) — recommended for ephemeral runners\nhelm install arc \\\n  --namespace arc-systems \\\n  --create-namespace \\\n  oci:\u002F\u002Fghcr.io\u002Factions\u002Factions-runner-controller-charts\u002Fgha-runner-scale-set-controller\n```\n\n---\n\n## Conditional Execution & Flow Control\n\n```yaml\n# Condition on branch + event\n- run: .\u002Fscripts\u002Fdeploy.sh\n  if: github.ref == 'refs\u002Fheads\u002Fmain' && github.event_name == 'push'\n\n# Continue on error (non-blocking steps)\n- run: .\u002Fscripts\u002Flint.sh\n  continue-on-error: true\n\n# Job dependency and conditional execution\njobs:\n  test:\n    runs-on: ubuntu-24.04\n    outputs:\n      result: ${{ steps.run-tests.outcome }}\n\n  deploy:\n    needs: [test, build]\n    if: |\n      needs.test.result == 'success' &&\n      needs.build.result == 'success' &&\n      github.ref == 'refs\u002Fheads\u002Fmain'\n    runs-on: ubuntu-24.04\n\n  notify-failure:\n    needs: [test, deploy]\n    if: failure()          # Runs even if earlier jobs fail\n    runs-on: ubuntu-24.04\n    steps:\n      - run: .\u002Fscripts\u002Fnotify-slack.sh \"Pipeline failed!\"\n```\n\n### Passing Data Between Jobs\n\n```yaml\njobs:\n  prepare:\n    runs-on: ubuntu-24.04\n    outputs:\n      version: ${{ steps.get-version.outputs.version }}\n      should-deploy: ${{ steps.check.outputs.deploy }}\n\n    steps:\n      - id: get-version\n        run: |\n          VERSION=$(tr -d '\\r\\n' \u003C VERSION)\n          case \"$VERSION\" in\n            \"\"|*[!0-9A-Za-z._-]*) echo \"Invalid VERSION\" >&2; exit 1 ;;\n          esac\n          printf 'version=%s\\n' \"$VERSION\" >> \"$GITHUB_OUTPUT\"\n\n      - id: check\n        run: |\n          if git log -1 --pretty=%B | grep -q '\\[deploy\\]'; then\n            echo \"deploy=true\" >> $GITHUB_OUTPUT\n          else\n            echo \"deploy=false\" >> $GITHUB_OUTPUT\n          fi\n\n  build:\n    needs: prepare\n    if: needs.prepare.outputs.should-deploy == 'true'\n    runs-on: ubuntu-24.04\n    steps:\n      - env:\n          VERSION: ${{ needs.prepare.outputs.version }}\n        run: echo \"Building version $VERSION\"\n```\n\n---\n\n## Security Hardening\n\n### 1. Always Declare Permissions (Least Privilege)\n\n```yaml\n# Workflow-level default — restrict everything\npermissions:\n  contents: read\n\njobs:\n  publish:\n    # Job-level override — only expand what's needed\n    permissions:\n      contents: write        # Only for release\u002Fpublish jobs\n      packages: write        # Only for container push jobs\n      pull-requests: write   # Only for PR comment jobs\n      id-token: write        # Only for OIDC auth jobs\n```\n\n### 2. Pin Third-Party Actions to Full Commit SHA\n\n```yaml\n# ❌ UNSAFE — tag can be mutated or hijacked\n- uses: actions\u002Fcheckout@v4\n\n# ✅ SAFE — commit SHA is immutable\n- uses: actions\u002Fcheckout@11bd71901bbe5b1630ceea73d27597364c9af683  # v4.2.2\n\n# Tool to automate SHA pinning:\n# npx pin-github-action .github\u002Fworkflows\u002F*.yml\n# or: pip install ratchet && ratchet pin .github\u002Fworkflows\u002F\n```\n\n### 3. Prevent Script Injection\n\n```yaml\n# ❌ UNSAFE — attacker controls PR title, which gets expanded in shell\n- run: echo \"${{ github.event.pull_request.title }}\"\n\n# ✅ SAFE — pass through environment variable (shell doesn't evaluate it)\n- env:\n    PR_TITLE: ${{ github.event.pull_request.title }}\n  run: echo \"$PR_TITLE\"\n\n# ✅ SAFE — expressions in if: conditions are evaluated by Actions, not shell\n- if: github.event.pull_request.draft == false\n  run: echo \"Not a draft\"\n```\n\nNever place `${{ ... }}` directly inside `run:` when the value can come from\nPR metadata, workflow inputs, repository files, matrix JSON, or earlier job\noutputs. Put it in `env:` first, validate allowlisted values where possible, and\nreference the shell variable with quotes.\n\n### 4. Restrict `pull_request_target` Usage\n\n```yaml\n# Only run when a maintainer adds a specific label — prevents untrusted execution\non:\n  pull_request_target:\n    types: [labeled]\n\njobs:\n  validate:\n    # Double-guard: check label name AND author_association\n    if: |\n      github.event.label.name == 'safe-to-test' &&\n      (github.event.pull_request.author_association == 'COLLABORATOR' ||\n       github.event.pull_request.author_association == 'MEMBER' ||\n       github.event.pull_request.author_association == 'OWNER')\n```\n\n### 5. Harden with StepSecurity\n\n```yaml\n# Add to every workflow — hardens runner, monitors outbound traffic\n- uses: step-security\u002Fharden-runner@4d991eb9995541a0b71d1b66f1f98a5f1bef422c  # v2.11.0\n  with:\n    egress-policy: audit          # Start with 'audit', move to 'block' after confirming allowlist\n    allowed-endpoints: >\n      api.github.com:443\n      registry.npmjs.org:443\n      objects.githubusercontent.com:443\n```\n\n---\n\n## Debugging Techniques\n\n```yaml\n# Enable runner diagnostic logging via repo secrets:\n# ACTIONS_RUNNER_DEBUG = true\n# ACTIONS_STEP_DEBUG = true\n\n# Dump full GitHub context for inspection\n- name: Debug — dump github context\n  if: runner.debug == '1'\n  env:\n    GITHUB_CONTEXT: ${{ toJson(github) }}\n  run: echo \"$GITHUB_CONTEXT\" | jq '.'\n\n# Dump all available contexts\n- name: Debug — dump all contexts\n  if: runner.debug == '1'\n  run: |\n    echo \"github: ${{ toJson(github) }}\"\n    echo \"env: ${{ toJson(env) }}\"\n    echo \"vars: ${{ toJson(vars) }}\"\n    echo \"runner: ${{ toJson(runner) }}\"\n\n# SSH into a failing runner for interactive debugging\n- uses: mxschmitt\u002Faction-tmate@7b04f3521e6b0a9fc56fa8f9f50da4bcfb5fc7b5  # v3.19.0\n  if: failure() && runner.debug == '1'\n  with:\n    limit-access-to-actor: true    # Only the workflow triggerer can SSH in\n    timeout-minutes: 30\n\n# Check what's pre-installed on GitHub-hosted runners\n- run: |\n    echo \"=== Tool Versions ===\" \n    node --version\n    python3 --version\n    go version\n    docker --version\n    echo \"=== Disk Space ===\"\n    df -h\n    echo \"=== Memory ===\"\n    free -h\n```\n\n---\n\n## Complete Pipeline Patterns\n\n### Pattern 1: Build → Test → Push → Deploy\n\n```yaml\nname: CI\u002FCD Pipeline\n\non:\n  push:\n    branches: [main]\n  pull_request:\n    branches: [main]\n\nconcurrency:\n  group: ${{ github.workflow }}-${{ github.ref }}\n  cancel-in-progress: ${{ github.ref != 'refs\u002Fheads\u002Fmain' }}\n\npermissions:\n  contents: read\n\njobs:\n  # ── Build & Test ──────────────────────────────────────\n  build-test:\n    runs-on: ubuntu-24.04\n    timeout-minutes: 20\n    permissions:\n      contents: read\n      checks: write        # For test result reporting\n\n    steps:\n      - uses: actions\u002Fcheckout@11bd71901bbe5b1630ceea73d27597364c9af683  # v4.2.2\n\n      - uses: actions\u002Fsetup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af  # v4.1.0\n        with:\n          node-version: '20'\n          cache: 'npm'\n\n      - run: npm ci\n      - run: npm run lint\n      - run: npm run test -- --coverage\n      - run: npm run build\n\n      - uses: actions\u002Fupload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882  # v4.4.3\n        with:\n          name: build-artifacts\n          path: dist\u002F\n          retention-days: 7\n\n  # ── Push Image (main branch only) ─────────────────────\n  push-image:\n    needs: build-test\n    if: github.ref == 'refs\u002Fheads\u002Fmain'\n    runs-on: ubuntu-24.04\n    timeout-minutes: 20\n    permissions:\n      contents: read\n      packages: write\n      id-token: write      # For OIDC\n    outputs:\n      image-digest: ${{ steps.push.outputs.digest }}\n\n    steps:\n      - uses: actions\u002Fcheckout@11bd71901bbe5b1630ceea73d27597364c9af683  # v4.2.2\n\n      - uses: docker\u002Fsetup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349  # v3.7.1\n\n      - uses: docker\u002Flogin-action@9780b0c442fbb1117ed29e0efdff1e18412f7567  # v3.3.0\n        with:\n          registry: ghcr.io\n          username: ${{ github.actor }}\n          password: ${{ secrets.GITHUB_TOKEN }}\n\n      - uses: docker\u002Fmetadata-action@70b2cdc6480c1a8b86edf1777157f8f437de2166  # v5.5.1\n        id: meta\n        with:\n          images: ghcr.io\u002F${{ github.repository }}\n          tags: |\n            type=sha,format=long\n            type=raw,value=latest\n\n      - id: push\n        uses: docker\u002Fbuild-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75  # v6.9.0\n        with:\n          context: .\n          push: true\n          tags: ${{ steps.meta.outputs.tags }}\n          labels: ${{ steps.meta.outputs.labels }}\n          cache-from: type=gha\n          cache-to: type=gha,mode=max\n          provenance: true    # SLSA provenance attestation\n          sbom: true          # Software Bill of Materials\n\n  # ── Deploy Staging ────────────────────────────────────\n  deploy-staging:\n    needs: push-image\n    runs-on: ubuntu-24.04\n    timeout-minutes: 30\n    environment:\n      name: staging\n      url: https:\u002F\u002Fstaging.myapp.com\n    steps:\n      - uses: actions\u002Fcheckout@11bd71901bbe5b1630ceea73d27597364c9af683  # v4.2.2\n      - env:\n          IMAGE_DIGEST: ${{ needs.push-image.outputs.image-digest }}\n        run: .\u002Fscripts\u002Fdeploy.sh staging \"$IMAGE_DIGEST\"\n\n  # ── Deploy Production (manual approval required) ──────\n  deploy-production:\n    needs: deploy-staging\n    runs-on: ubuntu-24.04\n    timeout-minutes: 30\n    environment:\n      name: production\n      url: https:\u002F\u002Fmyapp.com\n    steps:\n      - uses: actions\u002Fcheckout@11bd71901bbe5b1630ceea73d27597364c9af683  # v4.2.2\n      - env:\n          IMAGE_DIGEST: ${{ needs.push-image.outputs.image-digest }}\n        run: .\u002Fscripts\u002Fdeploy.sh production \"$IMAGE_DIGEST\"\n```\n\n### Pattern 2: Automated Release with Changelog\n\n```yaml\nname: Release\n\non:\n  push:\n    tags: ['v[0-9]+.[0-9]+.[0-9]+']\n\npermissions:\n  contents: write\n\njobs:\n  release:\n    runs-on: ubuntu-24.04\n    timeout-minutes: 15\n\n    steps:\n      - uses: actions\u002Fcheckout@11bd71901bbe5b1630ceea73d27597364c9af683  # v4.2.2\n        with:\n          fetch-depth: 0    # Full history needed for changelog generation\n\n      - uses: softprops\u002Faction-gh-release@e7a8f85e1c67a31e6ed99a94b41bd0b71bbee6b8  # v2.0.9\n        with:\n          generate_release_notes: true    # Auto-generates from PR titles and commits\n          make_latest: true\n          fail_on_unmatched_files: true\n          files: |\n            dist\u002F**\u002F*.tar.gz\n            dist\u002F**\u002F*.zip\n```\n\n### Pattern 3: Dependency Auto-Update with PR\n\n```yaml\nname: Dependency Updates\n\non:\n  schedule:\n    - cron: '0 9 * * 1'    # Every Monday at 9am UTC\n  workflow_dispatch:\n\npermissions:\n  contents: write\n  pull-requests: write\n\njobs:\n  update-deps:\n    runs-on: ubuntu-24.04\n    timeout-minutes: 20\n    steps:\n      - uses: actions\u002Fcheckout@11bd71901bbe5b1630ceea73d27597364c9af683  # v4.2.2\n\n      - uses: actions\u002Fsetup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af  # v4.1.0\n        with:\n          node-version: '20'\n\n      - run: npx npm-check-updates -u\n      - run: npm install\n\n      - uses: peter-evans\u002Fcreate-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f  # v7.0.5\n        with:\n          commit-message: 'chore: update npm dependencies'\n          title: 'chore: update npm dependencies'\n          branch: 'chore\u002Fnpm-updates'\n          delete-branch: true\n          body: |\n            Automated dependency updates generated by the dependency update workflow.\n            Please review and test before merging.\n```\n\n### Pattern 4: Security Scanning Pipeline\n\n```yaml\nname: Security Scan\n\non:\n  push:\n    branches: [main]\n  pull_request:\n    branches: [main]\n  schedule:\n    - cron: '0 6 * * *'    # Daily at 6am UTC\n\npermissions:\n  contents: read\n  security-events: write    # For uploading SARIF results\n\njobs:\n  codeql:\n    runs-on: ubuntu-24.04\n    timeout-minutes: 30\n    permissions:\n      security-events: write\n      actions: read\n      contents: read\n    steps:\n      - uses: actions\u002Fcheckout@11bd71901bbe5b1630ceea73d27597364c9af683  # v4.2.2\n      - uses: github\u002Fcodeql-action\u002Finit@4f3212b61783c3c68e8309a0f18a699764811cda  # v3.27.1\n        with:\n          languages: javascript-typescript\n      - uses: github\u002Fcodeql-action\u002Fautobuild@4f3212b61783c3c68e8309a0f18a699764811cda  # v3.27.1\n      - uses: github\u002Fcodeql-action\u002Fanalyze@4f3212b61783c3c68e8309a0f18a699764811cda  # v3.27.1\n\n  container-scan:\n    runs-on: ubuntu-24.04\n    timeout-minutes: 15\n    steps:\n      - uses: actions\u002Fcheckout@11bd71901bbe5b1630ceea73d27597364c9af683  # v4.2.2\n      - uses: aquasecurity\u002Ftrivy-action@6e7b7d1fd3e4fef0c5fa8cce1229c54b2c9bd0d8  # v0.28.0\n        with:\n          scan-type: 'fs'\n          format: 'sarif'\n          output: 'trivy-results.sarif'\n          severity: 'CRITICAL,HIGH'\n      - uses: github\u002Fcodeql-action\u002Fupload-sarif@4f3212b61783c3c68e8309a0f18a699764811cda  # v3.27.1\n        with:\n          sarif_file: 'trivy-results.sarif'\n```\n\n---\n\n## Common Pitfalls & Fixes\n\n| Problem | Cause | Fix |\n|---|---|---|\n| Workflow doesn't trigger on PR from fork | Fork PRs use restricted `GITHUB_TOKEN` | Use `pull_request` not `pull_request_target`; avoid repo secrets in fork context |\n| Secret is `***` in logs but exposed | Dynamic value not masked | Use `echo \"::add-mask::$VALUE\"` before using it |\n| Cache never hits across branches | Cache key too specific | Add `restore-keys` fallback without branch or hash segment |\n| Matrix job fails silently | `fail-fast: true` (default) cancels siblings | Set `fail-fast: false` during debugging |\n| Job hangs indefinitely | No `timeout-minutes` set | Always set `timeout-minutes` on every job |\n| `$GITHUB_OUTPUT` not set | Old `set-output` command used | Use `echo \"key=value\" >> $GITHUB_OUTPUT` |\n| OIDC token request fails | Missing `id-token: write` permission | Add to job-level `permissions` block |\n| Reusable workflow can't access caller secrets | No `secrets: inherit` | Add `secrets: inherit` or explicitly pass secrets |\n\n---\n\n## GitHub Actions Expressions Reference\n\n```yaml\n# Context objects available in expressions\n${{ github.sha }}                           # Commit SHA\n${{ github.ref }}                           # Branch\u002Ftag ref\n${{ github.ref_name }}                      # Short branch\u002Ftag name\n${{ github.event_name }}                    # Event name (push, pull_request, etc.)\n${{ github.actor }}                         # Username who triggered the run\n${{ github.repository }}                    # org\u002Frepo\n${{ github.run_id }}                        # Unique run ID\n${{ runner.os }}                            # Linux, Windows, macOS\n\n# Built-in functions\n${{ toJson(github) }}                       # Serialize context to JSON\n${{ fromJson(needs.job.outputs.matrix) }}   # Parse JSON string\n${{ hashFiles('**\u002Fpackage-lock.json') }}    # Hash file(s) for cache keys\n${{ format('{0}\u002F{1}', var1, var2) }}        # String formatting\n${{ join(matrix.items, ',') }}              # Join array\n\n# Status functions (use in if: conditions)\n${{ success() }}    # All previous steps succeeded\n${{ failure() }}    # Any previous step failed\n${{ cancelled() }}  # Workflow was cancelled\n${{ always() }}     # Always runs (success OR failure OR cancelled)\n```\n\n---\n\n## Production Readiness Checklist\n\nBefore merging any workflow to `main`, verify:\n\n### Security\n- [ ] All third-party actions pinned to full commit SHA\n- [ ] `permissions:` declared at workflow and job level (least privilege)\n- [ ] No `${{ }}` expressions directly in `run:` blocks (use env vars)\n- [ ] OIDC used for cloud credentials (no long-lived secrets stored)\n- [ ] `pull_request_target` gated with label check + author_association guard\n- [ ] Secrets never echoed or logged\n\n### Reliability\n- [ ] `timeout-minutes` set on every job\n- [ ] `fail-fast: false` set for matrix builds used for debugging\n- [ ] `concurrency` configured to cancel stale runs\n- [ ] Retry logic for flaky external calls\n- [ ] Artifact retention policy set appropriately\n\n### Performance\n- [ ] Dependency caching configured (setup-* cache or actions\u002Fcache)\n- [ ] Docker layer caching enabled (`type=gha`)\n- [ ] Path filters on `push`\u002F`pull_request` to skip unrelated changes\n- [ ] Matrix parallelism appropriate (not exhausting runner pool)\n\n### Maintainability\n- [ ] Reusable workflows used for repeated patterns\n- [ ] Composite actions used for repeated step sequences\n- [ ] Workflow names and step names are human-readable\n- [ ] `_` prefix on internal\u002Freusable workflow files\n- [ ] Environment protection rules configured for `production`\n\n---\n\n## Related Skills\n\n- `gha-security-review` — Deep security audit of existing workflow files\n- `github-actions-templates` — Copy-paste ready workflow templates\n- `docker-expert` — Container build optimization and Dockerfile best practices\n- `kubernetes-architect` — Deploying to Kubernetes from GitHub Actions\n- `gitlab-ci-patterns` — GitLab CI\u002FCD equivalent patterns\n\n## Limitations\n\n- Use this skill only when the task clearly matches the scope described above.\n- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.\n- Always test reusable workflows in a feature branch before merging to main.\n- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.\n","# GitHub Actions Advanced Skill\n\nExpert guidance for designing, writing, debugging, and securing **production-grade** GitHub Actions workflows.\n\n---\n\n## When to Use This Skill\n\n- User mentions GitHub Actions, `.github\u002Fworkflows`, CI\u002FCD pipelines, runners, jobs, steps, or actions\n- User wants to automate builds, tests, deployments, or releases via GitHub\n- User asks about matrix builds, reusable workflows, composite actions, or self-hosted runners\n- User needs help with OIDC authentication, caching strategies, or secrets management\n- User says \"my GitHub pipeline is failing\" or \"set up CI for my repo\"\n- User asks about workflow security, hardening, or environment protection rules\n\n## When NOT to Use This Skill\n\n- The user is working with GitLab CI\u002FCD → recommend `gitlab-ci-patterns`\n- The user is working with CircleCI, Jenkins, or other CI platforms\n- The task is purely about Docker image building without GitHub context → recommend `docker-expert`\n- The task is about Kubernetes deployment configuration → recommend `kubernetes-architect`\n\n---\n\n## Step 1: Understand Context Before Responding\n\nWhen invoked, first gather context:\n\n```bash\n# Discover existing workflows in the repo\nfind .github\u002Fworkflows -name \"*.yml\" -o -name \"*.yaml\" 2>\u002Fdev\u002Fnull | head -20\n\n# Check for composite actions\nfind .github\u002Factions -name \"action.yml\" 2>\u002Fdev\u002Fnull\n\n# Detect tech stack (influences runner OS, language setup actions)\nls package.json requirements.txt Gemfile go.mod Cargo.toml pom.xml 2>\u002Fdev\u002Fnull\n```\n\nThen adapt recommendations to:\n- Existing workflow patterns in the repo\n- The tech stack and language runtime\n- Whether this is a monorepo or single-project repo\n- Whether self-hosted or GitHub-hosted runners are in use\n\n---\n\n## Workflow Structure Reference\n\n```yaml\nname: Workflow Name\n\non:                          # Triggers (see Triggers section)\n  push:\n    branches: [main]\n\npermissions:                 # Always declare — principle of least privilege\n  contents: read\n\nenv:                         # Workflow-level env vars\n  NODE_VERSION: '20'\n\nconcurrency:                 # Prevent duplicate runs\n  group: ${{ github.workflow }}-${{ github.ref }}\n  cancel-in-progress: true   # Cancel older runs for same branch\n\njobs:\n  job-id:\n    name: Human-readable name\n    runs-on: ubuntu-24.04    # Pin OS version — never use -latest in prod\n    timeout-minutes: 15      # Always set — prevents runaway jobs\n    environment: production  # Links to GitHub Environment (approvals\u002Fsecrets)\n\n    steps:\n      - uses: actions\u002Fcheckout@11bd71901bbe5b1630ceea73d27597364c9af683  # v4.2.2\n      - name: Step name\n        run: echo \"hello\"\n```\n\n---\n\n## Triggers (`on:`)\n\n### Common Patterns\n\n```yaml\non:\n  push:\n    branches: [main, 'release\u002F**']\n    paths-ignore: ['**.md', 'docs\u002F**']   # Skip docs-only changes\n\n  pull_request:\n    types: [opened, synchronize, reopened]\n    branches: [main]\n\n  workflow_dispatch:                      # Manual trigger with inputs\n    inputs:\n      environment:\n        description: 'Deploy target'\n        required: true\n        type: choice\n        options: [staging, production]\n      dry-run:\n        description: 'Dry run only?'\n        type: boolean\n        default: false\n\n  schedule:\n    - cron: '0 2 * * 1'                 # Monday 2am UTC\n\n  workflow_call:                          # Called by other workflows (reusable)\n    inputs:\n      image-tag:\n        type: string\n        required: true\n    secrets:\n      deploy-token:\n        required: true\n\n  release:\n    types: [published]                   # Trigger only on published releases\n\n  pull_request_target:                   # Runs with repo secrets — use with care!\n    types: [labeled]                     # Gate with label + author_association check\n```\n\n> **Security Warning:** `pull_request_target` runs with repo secrets. Only use after a maintainer labels the PR. Never check out fork code without explicit sandboxing.\n\n---\n\n## Reusable Workflows\n\nSplit large pipelines into composable units stored in `.github\u002Fworkflows\u002F`.\n\n**Convention:** Prefix internal\u002Freusable workflows with `_` (e.g., `_build.yml`).\n\n### Caller (`.github\u002Fworkflows\u002Fdeploy.yml`)\n\n```yaml\njobs:\n  call-build:\n    uses: .\u002F.github\u002Fworkflows\u002F_build.yml        # Same-repo reusable\n    # uses: org\u002Frepo\u002F.github\u002Fworkflows\u002Fbuild.yml@main  # Cross-repo\n    with:\n      image-tag: ${{ github.sha }}\n    secrets: inherit                             # Pass all caller secrets down\n  \n  call-test:\n    uses: .\u002F.github\u002Fworkflows\u002F_test.yml\n    with:\n      node-version: '20'\n    secrets:\n      NPM_TOKEN: ${{ secrets.NPM_TOKEN }}       # Explicit secret passing\n```\n\n### Reusable Workflow (`.github\u002Fworkflows\u002F_build.yml`)\n\n```yaml\non:\n  workflow_call:\n    inputs:\n      image-tag:\n        type: string\n        required: true\n      push:\n        type: boolean\n        default: false\n    secrets:\n      registry-token:\n        required: false\n    outputs:\n      digest:\n        description: \"Image digest\"\n        value: ${{ jobs.build.outputs.digest }}\n\njobs:\n  build:\n    runs-on: ubuntu-24.04\n    timeout-minutes: 20\n    outputs:\n      digest: ${{ steps.build.outputs.digest }}\n    steps:\n      - uses: actions\u002Fcheckout@11bd71901bbe5b1630ceea73d27597364c9af683  # v4.2.2\n      - id: build\n        uses: docker\u002Fbuild-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75  # v6.9.0\n        with:\n          push: ${{ inputs.push }}\n          tags: myapp:${{ inputs.image-tag }}\n```\n\n---\n\n## Matrix Builds\n\n```yaml\njobs:\n  test:\n    strategy:\n      fail-fast: false           # Don't cancel others if one fails\n      max-parallel: 4            # Limit concurrent runners\n      matrix:\n        os: [ubuntu-24.04, windows-2022, macos-14]\n        node: ['18', '20', '22']\n        exclude:\n          - os: windows-2022\n            node: '18'\n        include:\n          - os: ubuntu-24.04\n            node: '22'\n            experimental: true   # Custom matrix variable\n\n    runs-on: ${{ matrix.os }}\n    timeout-minutes: 20\n\n    steps:\n      - uses: actions\u002Fcheckout@11bd71901bbe5b1630ceea73d27597364c9af683  # v4.2.2\n      - uses: actions\u002Fsetup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af  # v4.1.0\n        with:\n          node-version: ${{ matrix.node }}\n          cache: 'npm'\n      - run: npm ci\n      - run: npm test\n        continue-on-error: ${{ matrix.experimental == true }}\n```\n\n### Dynamic Matrix via Script\n\n```yaml\njobs:\n  generate-matrix:\n    runs-on: ubuntu-24.04\n    outputs:\n      matrix: ${{ steps.set-matrix.outputs.matrix }}\n    steps:\n      - uses: actions\u002Fcheckout@11bd71901bbe5b1630ceea73d27597364c9af683  # v4.2.2\n      - id: set-matrix\n        run: |\n          SERVICES=$(find services -mindepth 1 -maxdepth 1 -type d -printf '%f\\n' | jq -R -s -c 'split(\"\\n\")[:-1]')\n          printf 'matrix={\"service\":%s}\\n' \"$SERVICES\" >> \"$GITHUB_OUTPUT\"\n\n  build:\n    needs: generate-matrix\n    strategy:\n      matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}\n    runs-on: ubuntu-24.04\n    steps:\n      - env:\n          SERVICE: ${{ matrix.service }}\n        run: echo \"Building $SERVICE\"\n```\n\n---\n\n## Caching Strategies\n\n### Language Setup Actions (Preferred — No Extra Step Needed)\n\n```yaml\n# Node.js\n- uses: actions\u002Fsetup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af  # v4.1.0\n  with:\n    node-version: '20'\n    cache: 'npm'           # or 'yarn' or 'pnpm'\n\n# Python\n- uses: actions\u002Fsetup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b  # v5.3.0\n  with:\n    python-version: '3.12'\n    cache: 'pip'\n\n# Go\n- uses: actions\u002Fsetup-go@3041bf56c941b39c61721a86cd11f3bb1338122a  # v5.2.0\n  with:\n    go-version: '1.23'\n    cache: true\n\n# Java \u002F Gradle \u002F Maven\n- uses: actions\u002Fsetup-java@7a6d8a8234af8eb26422e24052f73b12b0e46a27  # v4.6.0\n  with:\n    distribution: 'temurin'\n    java-version: '21'\n    cache: 'maven'        # or 'gradle'\n```\n\n### Manual Cache (Any Tool)\n\n```yaml\n- uses: actions\u002Fcache@6849a6489940f00c2f30c0fb92c6274307ccb58a  # v4.1.2\n  id: cache-deps\n  with:\n    path: |\n      ~\u002F.cache\u002Fpip\n      .venv\n    key: ${{ runner.os }}-pip-${{ hashFiles('**\u002Frequirements*.txt') }}\n    restore-keys: |\n      ${{ runner.os }}-pip-${{ hashFiles('**\u002Frequirements*.txt') }}\n      ${{ runner.os }}-pip-\n\n- name: Install deps (only on cache miss)\n  if: steps.cache-deps.outputs.cache-hit != 'true'\n  run: pip install -r requirements.txt\n```\n\n### Docker Layer Caching\n\n```yaml\n- uses: docker\u002Fbuild-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75  # v6.9.0\n  with:\n    cache-from: type=gha\n    cache-to: type=gha,mode=max\n    # For registry-backed cache (cross-branch):\n    # cache-from: type=registry,ref=ghcr.io\u002Fmyorg\u002Fmyapp:buildcache\n    # cache-to: type=registry,ref=ghcr.io\u002Fmyorg\u002Fmyapp:buildcache,mode=max\n```\n\n---\n\n## OIDC Authentication (Keyless Cloud Auth)\n\n**Never store long-lived cloud credentials as secrets.** Use OIDC to get short-lived tokens that expire automatically.\n\n### AWS\n\n```yaml\npermissions:\n  id-token: write\n  contents: read\n\nsteps:\n  - uses: aws-actions\u002Fconfigure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502  # v4.0.2\n    with:\n      role-to-assume: arn:aws:iam::123456789012:role\u002FGitHubActionsRole\n      aws-region: us-east-1\n      role-session-name: GitHubActions-${{ github.run_id }}\n\n  # Trust policy on the IAM role must include:\n  # \"token.actions.githubusercontent.com\" as OIDC provider\n  # Condition: \"repo:org\u002Frepo:ref:refs\u002Fheads\u002Fmain\" (restrict to branch)\n```\n\n### GCP (Workload Identity Federation)\n\n```yaml\npermissions:\n  id-token: write\n  contents: read\n\nsteps:\n  - uses: google-github-actions\u002Fauth@6fc4af4b145ae7821d527454aa9bd537d1f2dc5f  # v2.1.7\n    with:\n      workload_identity_provider: projects\u002F123456789\u002Flocations\u002Fglobal\u002FworkloadIdentityPools\u002Fgithub-pool\u002Fproviders\u002Fgithub-provider\n      service_account: github-actions@my-project.iam.gserviceaccount.com\n      token_format: access_token   # or 'id_token'\n```\n\n### Azure (Federated Identity)\n\n```yaml\npermissions:\n  id-token: write\n  contents: read\n\nsteps:\n  - uses: azure\u002Flogin@a65d910e8af852a8061c627c456678983e180302  # v2.2.0\n    with:\n      client-id: ${{ secrets.AZURE_CLIENT_ID }}\n      tenant-id: ${{ secrets.AZURE_TENANT_ID }}\n      subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}\n      # No client secret needed! Uses OIDC federated credentials\n```\n\n---\n\n## Environments & Deployment Protection\n\n```yaml\njobs:\n  deploy-staging:\n    environment:\n      name: staging\n      url: https:\u002F\u002Fstaging.myapp.com\n    runs-on: ubuntu-24.04\n    timeout-minutes: 30\n    steps:\n      - run: .\u002Fscripts\u002Fdeploy.sh staging\n\n  deploy-production:\n    needs: deploy-staging\n    environment:\n      name: production\n      url: https:\u002F\u002Fmyapp.com      # Shown in the GitHub UI deployment panel\n    runs-on: ubuntu-24.04\n    timeout-minutes: 30\n    steps:\n      - run: .\u002Fscripts\u002Fdeploy.sh production\n```\n\n**Configure in Settings → Environments:**\n- **Required reviewers** — manual approval gate before run\n- **Wait timer** — delay after approval (e.g., 10-minute buffer)\n- **Branch\u002Ftag restrictions** — only `main` or `v*` tags can deploy to prod\n- **Environment-specific secrets** — override repo-level secrets per environment\n- **Deployment branches** — whitelist which branches can target this environment\n\n---\n\n## Secrets Management\n\n```yaml\n# Access repo\u002Forg\u002Fenvironment secrets\nenv:\n  DB_PASSWORD: ${{ secrets.DB_PASSWORD }}\n\n# Auto-provided token — no setup needed\n- uses: actions\u002Fgithub-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea  # v7.0.1\n  with:\n    github-token: ${{ secrets.GITHUB_TOKEN }}\n\n# Hierarchy (most specific wins):\n# environment secret > repo secret > org secret\n```\n\n### Masking Dynamic Values\n\n```yaml\n- name: Generate and mask dynamic token\n  run: |\n    TOKEN=$(.\u002Fscripts\u002Fgenerate-token.sh)\n    echo \"::add-mask::$TOKEN\"          # Mask in all subsequent logs\n    echo \"DEPLOY_TOKEN=$TOKEN\" >> $GITHUB_ENV\n```\n\n### Secrets in Composite Actions\n\n```yaml\n# Secrets cannot be passed as inputs to composite actions\n# Pass them as env vars instead:\n- uses: .\u002F.github\u002Factions\u002Fmy-action\n  env:\n    SECRET_VALUE: ${{ secrets.MY_SECRET }}\n```\n\n---\n\n## Composite Actions\n\nPackage reusable step sequences into local actions. No container spin-up, no separate workflow file needed.\n\n### Action Definition (`.github\u002Factions\u002Fsetup-app\u002Faction.yml`)\n\n```yaml\nname: Setup App\ndescription: Install and configure application dependencies\n\ninputs:\n  node-version:\n    description: 'Node.js version'\n    required: false\n    default: '20'\n  install-flags:\n    description: 'Additional npm install flags'\n    required: false\n    default: ''\n\noutputs:\n  cache-hit:\n    description: 'Whether the dependency cache was hit'\n    value: ${{ steps.cache.outputs.cache-hit }}\n\nruns:\n  using: composite\n  steps:\n    - uses: actions\u002Fsetup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af  # v4.1.0\n      with:\n        node-version: ${{ inputs.node-version }}\n        cache: npm\n\n    - id: cache\n      uses: actions\u002Fcache@6849a6489940f00c2f30c0fb92c6274307ccb58a  # v4.1.2\n      with:\n        path: node_modules\n        key: ${{ runner.os }}-node-${{ inputs.node-version }}-${{ hashFiles('package-lock.json') }}\n\n    - name: Install dependencies\n      if: steps.cache.outputs.cache-hit != 'true'\n      shell: bash\n      env:\n        INSTALL_FLAGS: ${{ inputs.install-flags }}\n      run: |\n        args=()\n        case \"$INSTALL_FLAGS\" in\n          \"\") ;;\n          \"--ignore-scripts\") args+=(--ignore-scripts) ;;\n          *) echo \"Unsupported install flags\" >&2; exit 1 ;;\n        esac\n        npm ci \"${args[@]}\"\n\n    - name: Build\n      shell: bash\n      run: npm run build\n```\n\n### Usage in a Workflow\n\n```yaml\nsteps:\n  - uses: actions\u002Fcheckout@11bd71901bbe5b1630ceea73d27597364c9af683  # v4.2.2\n  - uses: .\u002F.github\u002Factions\u002Fsetup-app\n    with:\n      node-version: '22'\n      install-flags: '--ignore-scripts'\n```\n\n---\n\n## Self-Hosted Runners\n\n```yaml\njobs:\n  build-gpu:\n    runs-on: [self-hosted, linux, x64, gpu]    # Label matching\n    timeout-minutes: 60\n\n  build-arm:\n    runs-on: [self-hosted, linux, arm64]\n```\n\n### Runner Best Practices\n\n| Practice | Details |\n|---|---|\n| **Ephemeral runners** | Use Actions Runner Controller (ARC) on Kubernetes for fresh runners per job |\n| **Isolation** | Never share prod runners with untrusted\u002Ffork PR workflows |\n| **Cleanup hooks** | Set `ACTIONS_RUNNER_HOOK_JOB_COMPLETED` to reset environment |\n| **Runner groups** | Use groups to restrict which repos\u002Fworkflows can access which runners |\n| **Labels** | Use custom labels (e.g., `gpu`, `high-memory`) for precise targeting |\n| **Security** | Disable fork PR access to self-hosted runners in Settings |\n\n```bash\n# Actions Runner Controller (Kubernetes) — recommended for ephemeral runners\nhelm install arc \\\n  --namespace arc-systems \\\n  --create-namespace \\\n  oci:\u002F\u002Fghcr.io\u002Factions\u002Factions-runner-controller-charts\u002Fgha-runner-scale-set-controller\n```\n\n---\n\n## Conditional Execution & Flow Control\n\n```yaml\n# Condition on branch + event\n- run: .\u002Fscripts\u002Fdeploy.sh\n  if: github.ref == 'refs\u002Fheads\u002Fmain' && github.event_name == 'push'\n\n# Continue on error (non-blocking steps)\n- run: .\u002Fscripts\u002Flint.sh\n  continue-on-error: true\n\n# Job dependency and conditional execution\njobs:\n  test:\n    runs-on: ubuntu-24.04\n    outputs:\n      result: ${{ steps.run-tests.outcome }}\n\n  deploy:\n    needs: [test, build]\n    if: |\n      needs.test.result == 'success' &&\n      needs.build.result == 'success' &&\n      github.ref == 'refs\u002Fheads\u002Fmain'\n    runs-on: ubuntu-24.04\n\n  notify-failure:\n    needs: [test, deploy]\n    if: failure()          # Runs even if earlier jobs fail\n    runs-on: ubuntu-24.04\n    steps:\n      - run: .\u002Fscripts\u002Fnotify-slack.sh \"Pipeline failed!\"\n```\n\n### Passing Data Between Jobs\n\n```yaml\njobs:\n  prepare:\n    runs-on: ubuntu-24.04\n    outputs:\n      version: ${{ steps.get-version.outputs.version }}\n      should-deploy: ${{ steps.check.outputs.deploy }}\n\n    steps:\n      - id: get-version\n        run: |\n          VERSION=$(tr -d '\\r\\n' \u003C VERSION)\n          case \"$VERSION\" in\n            \"\"|*[!0-9A-Za-z._-]*) echo \"Invalid VERSION\" >&2; exit 1 ;;\n          esac\n          printf 'version=%s\\n' \"$VERSION\" >> \"$GITHUB_OUTPUT\"\n\n      - id: check\n        run: |\n          if git log -1 --pretty=%B | grep -q '\\[deploy\\]'; then\n            echo \"deploy=true\" >> $GITHUB_OUTPUT\n          else\n            echo \"deploy=false\" >> $GITHUB_OUTPUT\n          fi\n\n  build:\n    needs: prepare\n    if: needs.prepare.outputs.should-deploy == 'true'\n    runs-on: ubuntu-24.04\n    steps:\n      - env:\n          VERSION: ${{ needs.prepare.outputs.version }}\n        run: echo \"Building version $VERSION\"\n```\n\n---\n\n## Security Hardening\n\n### 1. Always Declare Permissions (Least Privilege)\n\n```yaml\n# Workflow-level default — restrict everything\npermissions:\n  contents: read\n\njobs:\n  publish:\n    # Job-level override — only expand what's needed\n    permissions:\n      contents: write        # Only for release\u002Fpublish jobs\n      packages: write        # Only for container push jobs\n      pull-requests: write   # Only for PR comment jobs\n      id-token: write        # Only for OIDC auth jobs\n```\n\n### 2. Pin Third-Party Actions to Full Commit SHA\n\n```yaml\n# ❌ UNSAFE — tag can be mutated or hijacked\n- uses: actions\u002Fcheckout@v4\n\n# ✅ SAFE — commit SHA is immutable\n- uses: actions\u002Fcheckout@11bd71901bbe5b1630ceea73d27597364c9af683  # v4.2.2\n\n# Tool to automate SHA pinning:\n# npx pin-github-action .github\u002Fworkflows\u002F*.yml\n# or: pip install ratchet && ratchet pin .github\u002Fworkflows\u002F\n```\n\n### 3. Prevent Script Injection\n\n```yaml\n# ❌ UNSAFE — attacker controls PR title, which gets expanded in shell\n- run: echo \"${{ github.event.pull_request.title }}\"\n\n# ✅ SAFE — pass through environment variable (shell doesn't evaluate it)\n- env:\n    PR_TITLE: ${{ github.event.pull_request.title }}\n  run: echo \"$PR_TITLE\"\n\n# ✅ SAFE — expressions in if: conditions are evaluated by Actions, not shell\n- if: github.event.pull_request.draft == false\n  run: echo \"Not a draft\"\n```\n\nNever place `${{ ... }}` directly inside `run:` when the value can come from\nPR metadata, workflow inputs, repository files, matrix JSON, or earlier job\noutputs. Put it in `env:` first, validate allowlisted values where possible, and\nreference the shell variable with quotes.\n\n### 4. Restrict `pull_request_target` Usage\n\n```yaml\n# Only run when a maintainer adds a specific label — prevents untrusted execution\non:\n  pull_request_target:\n    types: [labeled]\n\njobs:\n  validate:\n    # Double-guard: check label name AND author_association\n    if: |\n      github.event.label.name == 'safe-to-test' &&\n      (github.event.pull_request.author_association == 'COLLABORATOR' ||\n       github.event.pull_request.author_association == 'MEMBER' ||\n       github.event.pull_request.author_association == 'OWNER')\n```\n\n### 5. Harden with StepSecurity\n\n```yaml\n# Add to every workflow — hardens runner, monitors outbound traffic\n- uses: step-security\u002Fharden-runner@4d991eb9995541a0b71d1b66f1f98a5f1bef422c  # v2.11.0\n  with:\n    egress-policy: audit          # Start with 'audit', move to 'block' after confirming allowlist\n    allowed-endpoints: >\n      api.github.com:443\n      registry.npmjs.org:443\n      objects.githubusercontent.com:443\n```\n\n---\n\n## Debugging Techniques\n\n```yaml\n# Enable runner diagnostic logging via repo secrets:\n# ACTIONS_RUNNER_DEBUG = true\n# ACTIONS_STEP_DEBUG = true\n\n# Dump full GitHub context for inspection\n- name: Debug — dump github context\n  if: runner.debug == '1'\n  env:\n    GITHUB_CONTEXT: ${{ toJson(github) }}\n  run: echo \"$GITHUB_CONTEXT\" | jq '.'\n\n# Dump all available contexts\n- name: Debug — dump all contexts\n  if: runner.debug == '1'\n  run: |\n    echo \"github: ${{ toJson(github) }}\"\n    echo \"env: ${{ toJson(env) }}\"\n    echo \"vars: ${{ toJson(vars) }}\"\n    echo \"runner: ${{ toJson(runner) }}\"\n\n# SSH into a failing runner for interactive debugging\n- uses: mxschmitt\u002Faction-tmate@7b04f3521e6b0a9fc56fa8f9f50da4bcfb5fc7b5  # v3.19.0\n  if: failure() && runner.debug == '1'\n  with:\n    limit-access-to-actor: true    # Only the workflow triggerer can SSH in\n    timeout-minutes: 30\n\n# Check what's pre-installed on GitHub-hosted runners\n- run: |\n    echo \"=== Tool Versions ===\" \n    node --version\n    python3 --version\n    go version\n    docker --version\n    echo \"=== Disk Space ===\"\n    df -h\n    echo \"=== Memory ===\"\n    free -h\n```\n\n---\n\n## Complete Pipeline Patterns\n\n### Pattern 1: Build → Test → Push → Deploy\n\n```yaml\nname: CI\u002FCD Pipeline\n\non:\n  push:\n    branches: [main]\n  pull_request:\n    branches: [main]\n\nconcurrency:\n  group: ${{ github.workflow }}-${{ github.ref }}\n  cancel-in-progress: ${{ github.ref != 'refs\u002Fheads\u002Fmain' }}\n\npermissions:\n  contents: read\n\njobs:\n  # ── Build & Test ──────────────────────────────────────\n  build-test:\n    runs-on: ubuntu-24.04\n    timeout-minutes: 20\n    permissions:\n      contents: read\n      checks: write        # For test result reporting\n\n    steps:\n      - uses: actions\u002Fcheckout@11bd71901bbe5b1630ceea73d27597364c9af683  # v4.2.2\n\n      - uses: actions\u002Fsetup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af  # v4.1.0\n        with:\n          node-version: '20'\n          cache: 'npm'\n\n      - run: npm ci\n      - run: npm run lint\n      - run: npm run test -- --coverage\n      - run: npm run build\n\n      - uses: actions\u002Fupload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882  # v4.4.3\n        with:\n          name: build-artifacts\n          path: dist\u002F\n          retention-days: 7\n\n  # ── Push Image (main branch only) ─────────────────────\n  push-image:\n    needs: build-test\n    if: github.ref == 'refs\u002Fheads\u002Fmain'\n    runs-on: ubuntu-24.04\n    timeout-minutes: 20\n    permissions:\n      contents: read\n      packages: write\n      id-token: write      # For OIDC\n    outputs:\n      image-digest: ${{ steps.push.outputs.digest }}\n\n    steps:\n      - uses: actions\u002Fcheckout@11bd71901bbe5b1630ceea73d27597364c9af683  # v4.2.2\n\n      - uses: docker\u002Fsetup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349  # v3.7.1\n\n      - uses: docker\u002Flogin-action@9780b0c442fbb1117ed29e0efdff1e18412f7567  # v3.3.0\n        with:\n          registry: ghcr.io\n          username: ${{ github.actor }}\n          password: ${{ secrets.GITHUB_TOKEN }}\n\n      - uses: docker\u002Fmetadata-action@70b2cdc6480c1a8b86edf1777157f8f437de2166  # v5.5.1\n        id: meta\n        with:\n          images: ghcr.io\u002F${{ github.repository }}\n          tags: |\n            type=sha,format=long\n            type=raw,value=latest\n\n      - id: push\n        uses: docker\u002Fbuild-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75  # v6.9.0\n        with:\n          context: .\n          push: true\n          tags: ${{ steps.meta.outputs.tags }}\n          labels: ${{ steps.meta.outputs.labels }}\n          cache-from: type=gha\n          cache-to: type=gha,mode=max\n          provenance: true    # SLSA provenance attestation\n          sbom: true          # Software Bill of Materials\n\n  # ── Deploy Staging ────────────────────────────────────\n  deploy-staging:\n    needs: push-image\n    runs-on: ubuntu-24.04\n    timeout-minutes: 30\n    environment:\n      name: staging\n      url: https:\u002F\u002Fstaging.myapp.com\n    steps:\n      - uses: actions\u002Fcheckout@11bd71901bbe5b1630ceea73d27597364c9af683  # v4.2.2\n      - env:\n          IMAGE_DIGEST: ${{ needs.push-image.outputs.image-digest }}\n        run: .\u002Fscripts\u002Fdeploy.sh staging \"$IMAGE_DIGEST\"\n\n  # ── Deploy Production (manual approval required) ──────\n  deploy-production:\n    needs: deploy-staging\n    runs-on: ubuntu-24.04\n    timeout-minutes: 30\n    environment:\n      name: production\n      url: https:\u002F\u002Fmyapp.com\n    steps:\n      - uses: actions\u002Fcheckout@11bd71901bbe5b1630ceea73d27597364c9af683  # v4.2.2\n      - env:\n          IMAGE_DIGEST: ${{ needs.push-image.outputs.image-digest }}\n        run: .\u002Fscripts\u002Fdeploy.sh production \"$IMAGE_DIGEST\"\n```\n\n### Pattern 2: Automated Release with Changelog\n\n```yaml\nname: Release\n\non:\n  push:\n    tags: ['v[0-9]+.[0-9]+.[0-9]+']\n\npermissions:\n  contents: write\n\njobs:\n  release:\n    runs-on: ubuntu-24.04\n    timeout-minutes: 15\n\n    steps:\n      - uses: actions\u002Fcheckout@11bd71901bbe5b1630ceea73d27597364c9af683  # v4.2.2\n        with:\n          fetch-depth: 0    # Full history needed for changelog generation\n\n      - uses: softprops\u002Faction-gh-release@e7a8f85e1c67a31e6ed99a94b41bd0b71bbee6b8  # v2.0.9\n        with:\n          generate_release_notes: true    # Auto-generates from PR titles and commits\n          make_latest: true\n          fail_on_unmatched_files: true\n          files: |\n            dist\u002F**\u002F*.tar.gz\n            dist\u002F**\u002F*.zip\n```\n\n### Pattern 3: Dependency Auto-Update with PR\n\n```yaml\nname: Dependency Updates\n\non:\n  schedule:\n    - cron: '0 9 * * 1'    # Every Monday at 9am UTC\n  workflow_dispatch:\n\npermissions:\n  contents: write\n  pull-requests: write\n\njobs:\n  update-deps:\n    runs-on: ubuntu-24.04\n    timeout-minutes: 20\n    steps:\n      - uses: actions\u002Fcheckout@11bd71901bbe5b1630ceea73d27597364c9af683  # v4.2.2\n\n      - uses: actions\u002Fsetup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af  # v4.1.0\n        with:\n          node-version: '20'\n\n      - run: npx npm-check-updates -u\n      - run: npm install\n\n      - uses: peter-evans\u002Fcreate-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f  # v7.0.5\n        with:\n          commit-message: 'chore: update npm dependencies'\n          title: 'chore: update npm dependencies'\n          branch: 'chore\u002Fnpm-updates'\n          delete-branch: true\n          body: |\n            Automated dependency updates generated by the dependency update workflow.\n            Please review and test before merging.\n```\n\n### Pattern 4: Security Scanning Pipeline\n\n```yaml\nname: Security Scan\n\non:\n  push:\n    branches: [main]\n  pull_request:\n    branches: [main]\n  schedule:\n    - cron: '0 6 * * *'    # Daily at 6am UTC\n\npermissions:\n  contents: read\n  security-events: write    # For uploading SARIF results\n\njobs:\n  codeql:\n    runs-on: ubuntu-24.04\n    timeout-minutes: 30\n    permissions:\n      security-events: write\n      actions: read\n      contents: read\n    steps:\n      - uses: actions\u002Fcheckout@11bd71901bbe5b1630ceea73d27597364c9af683  # v4.2.2\n      - uses: github\u002Fcodeql-action\u002Finit@4f3212b61783c3c68e8309a0f18a699764811cda  # v3.27.1\n        with:\n          languages: javascript-typescript\n      - uses: github\u002Fcodeql-action\u002Fautobuild@4f3212b61783c3c68e8309a0f18a699764811cda  # v3.27.1\n      - uses: github\u002Fcodeql-action\u002Fanalyze@4f3212b61783c3c68e8309a0f18a699764811cda  # v3.27.1\n\n  container-scan:\n    runs-on: ubuntu-24.04\n    timeout-minutes: 15\n    steps:\n      - uses: actions\u002Fcheckout@11bd71901bbe5b1630ceea73d27597364c9af683  # v4.2.2\n      - uses: aquasecurity\u002Ftrivy-action@6e7b7d1fd3e4fef0c5fa8cce1229c54b2c9bd0d8  # v0.28.0\n        with:\n          scan-type: 'fs'\n          format: 'sarif'\n          output: 'trivy-results.sarif'\n          severity: 'CRITICAL,HIGH'\n      - uses: github\u002Fcodeql-action\u002Fupload-sarif@4f3212b61783c3c68e8309a0f18a699764811cda  # v3.27.1\n        with:\n          sarif_file: 'trivy-results.sarif'\n```\n\n---\n\n## Common Pitfalls & Fixes\n\n| Problem | Cause | Fix |\n|---|---|---|\n| Workflow doesn't trigger on PR from fork | Fork PRs use restricted `GITHUB_TOKEN` | Use `pull_request` not `pull_request_target`; avoid repo secrets in fork context |\n| Secret is `***` in logs but exposed | Dynamic value not masked | Use `echo \"::add-mask::$VALUE\"` before using it |\n| Cache never hits across branches | Cache key too specific | Add `restore-keys` fallback without branch or hash segment |\n| Matrix job fails silently | `fail-fast: true` (default) cancels siblings | Set `fail-fast: false` during debugging |\n| Job hangs indefinitely | No `timeout-minutes` set | Always set `timeout-minutes` on every job |\n| `$GITHUB_OUTPUT` not set | Old `set-output` command used | Use `echo \"key=value\" >> $GITHUB_OUTPUT` |\n| OIDC token request fails | Missing `id-token: write` permission | Add to job-level `permissions` block |\n| Reusable workflow can't access caller secrets | No `secrets: inherit` | Add `secrets: inherit` or explicitly pass secrets |\n\n---\n\n## GitHub Actions Expressions Reference\n\n```yaml\n# Context objects available in expressions\n${{ github.sha }}                           # Commit SHA\n${{ github.ref }}                           # Branch\u002Ftag ref\n${{ github.ref_name }}                      # Short branch\u002Ftag name\n${{ github.event_name }}                    # Event name (push, pull_request, etc.)\n${{ github.actor }}                         # Username who triggered the run\n${{ github.repository }}                    # org\u002Frepo\n${{ github.run_id }}                        # Unique run ID\n${{ runner.os }}                            # Linux, Windows, macOS\n\n# Built-in functions\n${{ toJson(github) }}                       # Serialize context to JSON\n${{ fromJson(needs.job.outputs.matrix) }}   # Parse JSON string\n${{ hashFiles('**\u002Fpackage-lock.json') }}    # Hash file(s) for cache keys\n${{ format('{0}\u002F{1}', var1, var2) }}        # String formatting\n${{ join(matrix.items, ',') }}              # Join array\n\n# Status functions (use in if: conditions)\n${{ success() }}    # All previous steps succeeded\n${{ failure() }}    # Any previous step failed\n${{ cancelled() }}  # Workflow was cancelled\n${{ always() }}     # Always runs (success OR failure OR cancelled)\n```\n\n---\n\n## Production Readiness Checklist\n\nBefore merging any workflow to `main`, verify:\n\n### Security\n- [ ] All third-party actions pinned to full commit SHA\n- [ ] `permissions:` declared at workflow and job level (least privilege)\n- [ ] No `${{ }}` expressions directly in `run:` blocks (use env vars)\n- [ ] OIDC used for cloud credentials (no long-lived secrets stored)\n- [ ] `pull_request_target` gated with label check + author_association guard\n- [ ] Secrets never echoed or logged\n\n### Reliability\n- [ ] `timeout-minutes` set on every job\n- [ ] `fail-fast: false` set for matrix builds used for debugging\n- [ ] `concurrency` configured to cancel stale runs\n- [ ] Retry logic for flaky external calls\n- [ ] Artifact retention policy set appropriately\n\n### Performance\n- [ ] Dependency caching configured (setup-* cache or actions\u002Fcache)\n- [ ] Docker layer caching enabled (`type=gha`)\n- [ ] Path filters on `push`\u002F`pull_request` to skip unrelated changes\n- [ ] Matrix parallelism appropriate (not exhausting runner pool)\n\n### Maintainability\n- [ ] Reusable workflows used for repeated patterns\n- [ ] Composite actions used for repeated step sequences\n- [ ] Workflow names and step names are human-readable\n- [ ] `_` prefix on internal\u002Freusable workflow files\n- [ ] Environment protection rules configured for `production`\n\n---\n\n## Related Skills\n\n- `gha-security-review` — Deep security audit of existing workflow files\n- `github-actions-templates` — Copy-paste ready workflow templates\n- `docker-expert` — Container build optimization and Dockerfile best practices\n- `kubernetes-architect` — Deploying to Kubernetes from GitHub Actions\n- `gitlab-ci-patterns` — GitLab CI\u002FCD equivalent patterns\n\n## Limitations\n\n- Use this skill only when the task clearly matches the scope described above.\n- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.\n- Always test reusable workflows in a feature branch before merging to main.\n- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.\n",{"name":5,"risk":24,"source":25,"category":26,"date_added":27,"description":28},"safe","community","devops","2026-05-30","Design, debug, and harden GitHub Actions CI\u002FCD workflows, including reusable workflows, matrix builds, self-hosted runners, OIDC authentication, caching, environments, secrets, and release automation.\n","main","481dcd7dd2e288b9d627a2bd017db70e64e6c6fa","core\u002Fskills\u002Fgithub-actions-advanced",2,"https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI","https:\u002F\u002Fyana.vutam.link\u002F","https:\u002F\u002Fgithub.com\u002FHoronomos-laps","https:\u002F\u002Fyana.vutam.link","An open-source governed runtime & execution environment for multi-agent AI systems.","2026-11-14 13:24:09",{"source":8,"skillName":5,"commands":40,"prompt":50,"zipAvailable":51},[41,44,47],{"tool":42,"command":43},"npx","npx skills add Horonomos-laps\u002FYana-AI --skill github-actions-advanced",{"tool":45,"command":46},"bunx","bunx skills add Horonomos-laps\u002FYana-AI --skill github-actions-advanced",{"tool":48,"command":49},"pnpm","pnpm dlx skills add Horonomos-laps\u002FYana-AI --skill github-actions-advanced","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002Fcore\u002Fskills\u002Fgithub-actions-advanced\u002FSKILL.md",true,[],[54,62,69,77,85,93],{"skillNo":55,"name":56,"nameZh":6,"description":57,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":58,"licenseFileUrl":6,"sourceHtmlUrl":59,"categories":60,"keywords":61,"publishedAt":19},"01M735GKET5YVYKAY62W2P5YXB","openai--sentry--sentry","Use when the user asks to inspect Sentry issues or events, summarize recent production errors, or pull basic Sentry health data via the Sentry API; perform read-only queries with the bundled script and require `SENTRY_AUTH_TOKEN`.","MIT","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fopenai--sentry--sentry\u002FSKILL.md",[],[],{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":19},"01M73DCAP83T17HY7SMGK7MGFE","ito-basket-compare","Compare Itô prediction-market baskets against a user's knowledge base, portfolio notes, financial context, watchlist, or research thesis. Use for read-only basket comparison and gap analysis without investment advice or live trading.","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002Fcore\u002Fskills\u002Fito-basket-compare\u002FSKILL.md",[],[],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":73,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":19},"01M734CYEMZFDR3KH6SW0JP8TD","implementing-network-traffic-baselining","Build network traffic baselines from NetFlow\u002FIPFIX data using Python pandas for statistical analysis, z-score anomaly detection, and hourly\u002Fdaily traffic pattern profiling","https:\u002F\u002Fgithub.com\u002Fyanacuti1121\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimplementing-network-traffic-baselining\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimplementing-network-traffic-baselining\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":81,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":19},"01M73ASZ6NJRJM44Z2P84NGQ3Q","detecting-evasion-techniques-in-endpoint-logs","Detects defense evasion techniques used by adversaries in endpoint logs including log tampering, timestomping, process injection, and security tool disabling. Use when investigating suspicious endpoint behavior, building detection rules for evasion tactics, or conducting threat hunting for stealthy adversary activity. Activates for requests involving evasion detection, defense evasion analysis, log tampering detection, or MITRE ATT&CK TA0005.","https:\u002F\u002Fgithub.com\u002Fyanacuti1121\u002FYana-AI\u002Fblob\u002Fmain\u002Fcore\u002Fskills\u002Fdetecting-evasion-techniques-in-endpoint-logs\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002Fcore\u002Fskills\u002Fdetecting-evasion-techniques-in-endpoint-logs\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":89,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":19},"01M734AFNXD06Z78QRK0VKGT7Q","implementing-microsegmentation-with-guardicore","Implementing microsegmentation using Akamai Guardicore Segmentation to map application dependencies, create granular network policies, visualize east-west traffic flows, and enforce least-privilege communication between workloads across data centers and cloud.","https:\u002F\u002Fgithub.com\u002Fyanacuti1121\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimplementing-microsegmentation-with-guardicore\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimplementing-microsegmentation-with-guardicore\u002FSKILL.md",[],[],{"skillNo":94,"name":95,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":19},"01M736TK27QMCXK0DVCH25SJN5","ramdisk-tmpfs-patterns","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Framdisk-tmpfs-patterns\u002FSKILL.md",[],[]]