---
title: "The DevSecOps Publisher, Part 2: Two-Tier Repositories & Debugging GitHub Actions Nested Concurrency Deadlocks"
date: 2026-12-01
canonical: "https://codeandcypher.com/posts/two-tier-repositories-and-github-actions-concurrency-deadlocks/"
description: "Separate an open-source Hugo publishing engine from a private vault using Git remotes and reusable GitHub Actions—and fix 0-second concurrency deadlocks."
author: "Joshua Wortz"
---

# The DevSecOps Publisher, Part 2: Two-Tier Repositories & Debugging GitHub Actions Nested Concurrency Deadlocks


> Separate an open-source Hugo publishing engine from a private vault using Git remotes and reusable GitHub Actions—and fix 0-second concurrency deadlocks.

---



In [Part 1 of *The DevSecOps Publisher*](/posts/engineering-a-zero-trust-publishing-pipeline/), we examined the core architectural philosophy behind **Code and Cypher**: decoupling a platform-agnostic build and verification gatekeeper from pluggable edge deployment adapters. By treating every markdown commit like a production software release—enforcing Gitleaks credential scans, Subresource Integrity (SRI), and 86 automated Python unit tests—we eliminated the runtime attack surface of traditional database-backed CMS platforms.

Once that engine was hardened, we wanted to open-source the entire verification framework as [`SixFiveMil/hugo-devsecops-starter`](https://github.com/SixFiveMil/hugo-devsecops-starter) so other security engineers and researchers could deploy their own zero-trust publications.

That decision immediately surfaced an architectural conflict: **how do you open-source your active publishing engine and CI/CD test harness while keeping your authoring repository, embargoed vulnerability research, and unreleased drafts completely private?**

In this deep dive—Part 2 of *The DevSecOps Publisher*—we dissect the **Two-Tier Repository Architecture**, compare **Git Upstream Remotes** against **Reusable GitHub Actions (`workflow_call`)**, and walk through the forensic post-mortem of a subtle GitHub Actions failure mode: the **0-second Nested Concurrency Deadlock**.

---

## 1. The Threat Model: Why Public Repositories Break Editorial Embargoes

A common misconception among developers migrating to static site generators (Hugo, Astro, Eleventy, Jekyll) is that marking a post `draft: true` or setting a future `publishDate` protects unpublished content in a public GitHub repository.

It does not.

- **Build-Time vs. Source-Time Visibility**: Setting `draft: true` only instructs the Hugo compiler to omit the file from the compiled `./public` HTML bundle. In a public GitHub repository, the raw `.md` file inside `content/posts/` is immediately readable by anyone browsing the commit history, branch tree, or GitHub REST API.
- **No "Private Branches" in Public Repos**: GitHub's permission model operates at the repository boundary. You cannot make a `develop` or `drafts` branch private inside a public repository. Every commit pushed to a feature branch or opened in a pull request is indexed and scraped within seconds.
- **Editorial Metadata Leakage**: Beyond article prose, active publishing repositories frequently contain editorial calendars (`.ics`), distribution copy, and internal correlation tooling that should remain internal until launch day.

To open-source the engine without exposing the vault, we must split the system across two distinct trust boundaries.

```mermaid
flowchart LR
    subgraph Tier1["Tier 1: Public Open-Source Engine (World-Readable)"]
        PUB_REPO["SixFiveMil/hugo-devsecops-starter"]
        PUB_TESTS["tests/ (Platform-Agnostic Security Gates)"]
        PUB_WF[".github/workflows/reusable-verify.yml"]
        PUB_LAYOUTS["layouts/ & assets/ (Core Theme & UDL A11y)"]
    end

    subgraph Tier2["Tier 2: Private Production Vault (Restricted Access)"]
        PRIV_REPO["SixFiveMil/code-and-cypher"]
        PRIV_CONTENT["content/ (Published Posts, Papers & Series)"]
        PRIV_DEPLOY[".github/workflows/deploy.yml"]
        PRIV_SCRIPTS["scripts/ (Editorial Feed & Vault Bridge)"]
    end

    subgraph Tier0["Tier 0: Local Authoring Sanctuary (Off-Git)"]
        OBSIDIAN["Private Obsidian Vault (0_Drafts & 1_Ready_to_Publish)"]
    end

    OBSIDIAN -->|"sync_vault_posts.py (Draft Gate: draft=false)"| PRIV_CONTENT
    PUB_TESTS -->|"Pattern A: git merge starter/main"| PRIV_REPO
    PUB_WF -->|"Pattern B: uses: ...@v1.1.1 (workflow_call)"| PRIV_DEPLOY
```

As illustrated above, we actually enforce **three** concentric rings of isolation:
1. **Tier 0 (Off-Git Authoring Vault)**: Raw ideas, intelligence briefings, and works-in-progress (`draft: true`) live in a private Obsidian vault. Our synchronization bridge (`scripts/sync_vault_posts.py`) refuses to promote any markdown file to the Git repository unless `draft: false` is explicitly set and all privacy-leakage checks pass.
2. **Tier 2 (Private Production Git Repository)**: Holds finalized content, academic paper manifests, and the environment-specific deployment adapter (`.github/workflows/deploy.yml`).
3. **Tier 1 (Public Open-Source Starter)**: Holds the platform-agnostic verification suite (`tests/`), baseline layouts, and the reusable CI/CD verification workflow (`reusable-verify.yml`).

---

## 2. Synchronizing the Two Tiers: Git Upstream Remotes vs. Reusable Workflows

When maintaining a public starter template alongside a private production repository, you have two primary mechanisms for propagating engine upgrades (new security tests, Hugo version bumps, or accessibility fixes) from Tier 1 into Tier 2.

### Pattern A: The Multi-Remote Git Topology (`git merge starter/main`)

In a multi-remote topology, your private repository tracks two Git remotes: `origin` (your private repository) and `starter` (the public open-source template).

```bash
# 1. Register the public engine as a read-only upstream remote
git remote add starter https://github.com/SixFiveMil/hugo-devsecops-starter.git

# 2. Prevent accidental pushes of private commits to the public starter!
git remote set-url --push starter DISABLED
```

> [!CAUTION]
> **Always disable push URLs on public upstream remotes.** Running `git remote set-url --push starter DISABLED` guarantees that an errant `git push starter` from your private workstation will immediately fail with an invalid URL error rather than pushing private commit history to your public repository.

To pull upstream engine improvements into your private `develop` branch:

```bash
git checkout develop
git fetch starter
git merge starter/main --no-commit
```

#### Why `tests/` Directory Invariance Matters
For `git merge starter/main` to succeed cleanly over months of divergence, both repositories must maintain a strict **structural contract**:
- **Engine files (`tests/`) remain 100% platform-agnostic.** Notice how our test suite dynamically reads domain configuration and canonical baselines from `hugo.toml` and `data/canonical_slugs.json` rather than hardcoding `codeandcypher.com` inside `tests/*.py`.
- Because `tests/` is never modified with site-specific hacks inside the private repository, upstream updates to `tests/` fast-forward cleanly across the boundary without merge conflicts.

### Pattern B: Cross-Repository Reusable Workflows (`workflow_call`)

Rather than duplicating 120 lines of CI/CD YAML across every repository that uses the engine, GitHub Actions allows a workflow in a public repository to act as a versioned, callable subroutine via the `on: workflow_call` trigger.

In the public starter (`SixFiveMil/hugo-devsecops-starter/.github/workflows/reusable-verify.yml`), we expose a parameterized verification contract:

```yaml
name: Reusable Hugo DevSecOps Verification

on:
  workflow_call:
    inputs:
      hugo-version:
        description: "Hugo Extended version to compile with"
        required: false
        type: string
        default: "0.145.0"
      python-version:
        description: "Python runtime for security quality gates"
        required: false
        type: string
        default: "3.12"
      upload-artifact:
        description: "Whether to archive ./public for downstream deployment jobs"
        required: false
        type: boolean
        default: true

jobs:
  verify:
    name: Agnostic Build & DevSecOps Gates
    runs-on: ubuntu-latest
    steps:
      - name: Check out caller repository
        uses: actions/checkout@v4
        with:
          submodules: recursive
          fetch-depth: 0

      - name: Run Gitleaks Secret Scanner
        uses: gitleaks/gitleaks-action@v2
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

      - name: Setup Hugo Extended
        uses: peaceiris/actions-hugo@v3
        with:
          hugo-version: ${{ inputs.hugo-version }}
          extended: true

      - name: Compile Static Site
        run: hugo --minify --gc --cleanDestinationDir

      - name: Setup Python Runtime
        uses: actions/setup-python@v5
        with:
          python-version: ${{ inputs.python-version }}

      - name: Execute DevSecOps Test Suite
        run: python -m unittest discover -s tests -v

      - name: Upload Verified Artifact Bundle
        if: inputs.upload-artifact
        uses: actions/upload-artifact@v4
        with:
          name: verified-public-site
          path: public/
          retention-days: 1
```

In our private production repository (`.github/workflows/deploy.yml`), `JOB 1` shrinks to five lines pinned to an immutable semantic version tag (`@v1.1.1`):

```yaml
jobs:
  verify:
    uses: SixFiveMil/hugo-devsecops-starter/.github/workflows/reusable-verify.yml@v1.1.1
    with:
      upload-artifact: ${{ github.event_name != 'pull_request' }}
    secrets: inherit
```

### Architectural Trade-Off Comparison

| Dimension | Pattern A: Git Upstream Remote | Pattern B: Reusable `workflow_call` | Our Production Strategy |
| :--- | :--- | :--- | :--- |
| **Local CLI Verification** | `python -m unittest` runs locally offline | Only executes inside GitHub Actions runners | **Hybrid**: Sync `tests/` via Git + invoke `reusable-verify.yml` in CI |
| **Version Pinning** | Tied to last `git merge` commit | Pin to semantic tag (`@v1.1.1`) or commit SHA | Pin CI to `@v1.1.1` for deterministic builds |
| **Supply-Chain Blast Radius** | Audited during local merge review | Mutable if pinned to `@main` | Never pin cross-repo workflows to mutable branches in production |
| **Artifact Handoff** | N/A (local filesystem) | Cross-job `upload-artifact` / `download-artifact` | Skip artifact upload on PRs (`upload-artifact: false`) to save storage |

---

## 3. Forensic Post-Mortem: The 0-Second Nested Concurrency Deadlock

When we first wired our private `.github/workflows/deploy.yml` caller to the public `reusable-verify.yml` callee, we hit a baffling failure mode. Every `git push` triggered the workflow, acquired a runner, and **immediately cancelled itself at `0s` elapsed time** before executing a single step.

No syntax error. No failed unit test. Just an instant cancellation across both the caller job and the child job.

### Reconstructing the Crime Scene

To prevent redundant builds when pushing rapid commits to a branch, standard DevSecOps hardening recommends adding a top-level `concurrency` block to your workflow:

```yaml
# Present in BOTH the private caller (deploy.yml) AND the public callee (reusable-verify.yml)
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
```

On the surface, this looks harmless—even defensive. You might assume that in the caller workflow, `${{ github.workflow }}` evaluates to `"Build and Deploy codeandcypher.com"`, while inside the reusable workflow, `${{ github.workflow }}` evaluates to `"Reusable Hugo DevSecOps Verification"`.

**That assumption is false.**

### How GitHub Actions Evaluates `${{ github.workflow }}` Across `workflow_call` Boundaries

In the GitHub Actions execution engine, the `github` context is inherited from the **root triggering workflow** for the entire duration of the run:

1. **Step 1 (Caller Acquires Mutex)**: When a commit lands on `refs/heads/develop`, the parent workflow (`deploy.yml`) starts. It evaluates `${{ github.workflow }}-${{ github.ref }}` to:
   ```text
   Build and Deploy codeandcypher.com-refs/heads/develop
   ```
   The parent workflow acquires an active lock on this concurrency group and enters the `in_progress` state.
2. **Step 2 (Parent Spawns Child Job)**: The parent workflow reaches the `verify` job (`uses: SixFiveMil/hugo-devsecops-starter/.github/workflows/reusable-verify.yml@v1.1.1`) and dispatches the child workflow while **continuing to hold the parent concurrency lock**.
3. **Step 3 (Child Evaluates the Identical Context)**: Before the child workflow can allocate a runner, it evaluates its own top-level `concurrency` block: `${{ github.workflow }}-${{ github.ref }}`. Because `${{ github.workflow }}` resolves to the **root caller's name**, the child computes the exact same mutex string:
   ```text
   Build and Deploy codeandcypher.com-refs/heads/develop
   ```
4. **Step 4 (Self-Cancellation / Circular Wait)**: Because `cancel-in-progress: true` is set on that concurrency group, the child workflow's request to enter the group signals the GitHub Actions scheduler to **cancel the currently running holder of that group**—which is its own parent caller! Cancelling the parent immediately terminates the child.

```mermaid
sequenceDiagram
    autonumber
    participant Git as Git Push (develop)
    participant Scheduler as GitHub Actions Mutex Scheduler
    participant Caller as Parent Workflow (deploy.yml)
    participant Callee as Reusable Workflow (reusable-verify.yml)

    Git->>Caller: Trigger workflow run
    Caller->>Scheduler: Request lock("Build and Deploy...-refs/heads/develop")
    Scheduler-->>Caller: Lock GRANTED (Caller is now in_progress)
    Caller->>Callee: Invoke uses: reusable-verify.yml
    Note over Callee: Evaluates ${{ github.workflow }}<br/>Inherits caller's workflow name!
    Callee->>Scheduler: Request lock("Build and Deploy...-refs/heads/develop")<br/>with cancel-in-progress: true
    Scheduler->>Caller: CANCEL current lock holder!
    Caller->>Callee: Parent terminated -> abort child job (0s elapsed)
```

### The Fix and Engineering Rule

A reusable workflow should **never** define a top-level `concurrency` block using `${{ github.workflow }}`. Concurrency orchestration is the sole responsibility of the root caller workflow (`deploy.yml`).

- **If a reusable workflow is pure verification** (building and testing an isolated workspace checkout), remove `concurrency:` from `reusable-verify.yml` completely.
- **If a reusable job genuinely mutates a shared external state** (such as a specific cloud environment) and must serialize execution regardless of caller, scope its job-level concurrency group to an explicit, caller-supplied input or a static prefix (`group: reusable-verify-${{ github.repository }}-${{ github.ref }}`) that can never collide with the parent's top-level group.

---

## 4. Two More `workflow_call` Traps That Break Production Pipelines

Fixing the nested concurrency deadlock uncovered two additional edge cases in GitHub Actions' reusable workflow engine that caught our team during initial deployment.

### Trap 1: The Orchestration Job Schema Rejection ("Caller Syntax Trap")

In a standard GitHub Actions job, you routinely attach `runs-on:`, `env:`, or step-level configurations. However, a job that invokes `uses: <owner>/<repo>/.github/workflows/<file>.yml@<ref>` is an **orchestration pointer**, not a runner job.

```yaml
# ❌ BROKEN: GitHub Actions rejects this workflow at parse time
jobs:
  verify:
    name: Verify Site
    runs-on: ubuntu-latest          # <-- ILLEGAL on a workflow_call caller job
    env:                            # <-- ILLEGAL on a workflow_call caller job
      HUGO_ENV: production
    uses: SixFiveMil/hugo-devsecops-starter/.github/workflows/reusable-verify.yml@v1.1.1
```

If you include `runs-on:`, `env:`, `defaults:`, or `steps:` alongside `uses:`, the workflow fails during YAML schema validation before any runner starts. Data can only cross the caller-callee boundary via declared `with:` inputs and `secrets:`.

### Trap 2: Implicit Token Stripping and `secrets: inherit`

In a standalone workflow, `secrets.GITHUB_TOKEN` is implicitly available to every action step. When you cross a `workflow_call` boundary—even within the same user account or organization—secrets are **not** passed implicitly by default.

When our reusable workflow ran `gitleaks/gitleaks-action@v2`, the scanner abruptly failed because `GITHUB_TOKEN` evaluated to an empty string inside the child context. To allow the reusable verifier to authenticate with the repository's commit graph (without exposing deployment credentials like `CLOUDFLARE_API_TOKEN` to third-party code), you have two options:

1. **Same-Account / Trusted Starter (`secrets: inherit`)**: When both repositories belong to the same owner (`SixFiveMil`), `secrets: inherit` cleanly passes the caller's secret context into the reusable workflow.
2. **Least-Privilege Explicit Scoping**: Notice in our `.github/workflows/deploy.yml` how we pair `secrets: inherit` with a strict top-level `permissions:` block and isolate the Cloudflare deployment into `JOB 2` (`deploy-cloudflare`), which only runs `if: github.event_name != 'pull_request' && success()`. Even if a pull request triggers `JOB 1` (`verify`), `upload-artifact` is bypassed and `deploy-cloudflare` is completely skipped.

---

## 5. Verification Checklist for Two-Tier Static Pipelines

If you are splitting your existing static site or engineering blog into a public engine and a private authoring vault, run through this 5-point hardening checklist (aligned with our [Secure Software Development Program (SSDP) research](/papers/designing-a-secure-software-development-program/)):

1. **Disable Push on Upstream Starter Remotes**: Run `git remote set-url --push starter DISABLED` in your private repository so private drafts can never be accidentally pushed to the public remote.
2. **Enforce Test Directory Invariance**: Keep `tests/` 100% free of hardcoded domain strings so upstream test upgrades merge without conflicts.
3. **Strip Concurrency Blocks from Reusable Workflows**: Keep `concurrency: group: ${{ github.workflow }}-${{ github.ref }}` strictly in the root caller workflow to avoid the 0-second self-cancellation deadlock.
4. **Pin Cross-Repository Workflows to Immutable Tags**: Reference `@v1.1.1` or a full 40-character commit SHA—never `@main`—when calling a public reusable workflow from a private production repository.
5. **Gate Artifact Uploads on Pull Requests**: Pass `upload-artifact: ${{ github.event_name != 'pull_request' }}` so untrusted PR builds verify cleanly without consuming artifact storage or staging deployment bundles.

---

## What's Next in the Series

In **Part 3 of *The DevSecOps Publisher*** (the series finale), we move from verification to edge delivery: building **pluggable deployment adapters** for Cloudflare Pages (`master` production vs. `develop` preview isolation), automating production-only **IndexNow search engine notifications** with multi-endpoint failover, and rendering **sanitized live build telemetry** on our Colophon page without leaking runner paths.

> [!TIP]
> **Clone the Starter Engine**: You can inspect the complete `reusable-verify.yml` workflow and 86-test Python quality gate suite in [`SixFiveMil/hugo-devsecops-starter`](https://github.com/SixFiveMil/hugo-devsecops-starter), or browse our full tool catalog on the [Projects Directory](/projects/).

