Skip to content

Establish secure GitHub Actions workflows and repository automation #19

Open

Description

@Muawiya-contact

Why

DocHeal is an open-source repository and needs a deliberate, secure GitHub workflow setup as it grows. At present, the repository has contributor-facing issue/PR templates and a starter backlog, but no .github/workflows/ automation was found on the default branch. Issue #14 — Run the local checks in GitHub Actions already covers the first basic CI workflow; this issue should build on that work rather than create a competing duplicate.

The repository is still idea-stage: there is no runnable application, package manifest, test suite, or stable build command yet. Automation must reflect what actually exists and must not invent a toolchain or make every documentation-only PR wait on speculative jobs.

Goal

Research, design, and implement a maintainable GitHub Actions and repository-automation baseline for DocHeal. The result should make contributions safer and easier to review, catch regressions automatically when real checks exist, keep the repository tidy, and provide a clear path to releases as the project matures.

Research must happen before implementation. Do not start by copying a generic workflow template. First inspect the current default branch, repository settings, issue/PR templates, contribution guide, project roadmap, and all existing workflows/settings. Re-check the current GitHub Actions documentation and relevant security guidance at implementation time.

Phase 1 — Repository and workflow audit (required first)

  • Inventory the current repository structure, default branch, existing .github/ files, issue forms, PR template, labels, branch protections/rulesets, merge options, and Actions settings.
  • Review issue Run the local checks in GitHub Actions #14 and decide how its basic CI scope should fit into the overall design. Keep one coherent CI pipeline; update or link the existing issue if appropriate rather than duplicating it.
  • Identify which checks are genuinely runnable today (currently documentation/configuration validation only) and which must wait until a CLI, package, dependencies, and tests exist.
  • Research current GitHub recommendations for least-privilege GITHUB_TOKEN permissions, safe pull-request triggers, fork behavior, action pinning, concurrency, dependency updates, and automatic branch deletion.
  • Produce a short workflow plan/table: workflow name, trigger, purpose, permissions, required secrets (if any), checks performed, and prerequisites.
  • Record explicit non-goals and avoid adding workflows that have no meaningful command or maintenance value yet.

Phase 2 — Implement the appropriate baseline

Design and add only the workflows justified by the audit. Consider the following areas; adopt, defer, or reject each with a brief reason:

Pull request and push validation

  • A single CI workflow for pull requests and pushes to the default branch, coordinated with issue Run the local checks in GitHub Actions #14.
  • Run only real, documented checks. Initially this may include Markdown/link validation, YAML validation for issue forms/workflows, and whitespace/diff checks if reliable tooling is available.
  • When the first application/test command is introduced, extend CI to install the documented runtime/dependencies and run tests, lint, type checks, and build checks that the project actually supports.
  • Ensure failed checks return a failing status; avoid silently swallowing errors.
  • Use path filters only where they cannot accidentally skip required checks or leave required status checks pending.

Workflow security and efficiency

  • Set explicit least-privilege workflow/job permissions; default to read-only and grant write permissions only to a narrowly scoped job that demonstrably needs them.
  • Prefer pull_request for untrusted contribution validation. Do not use pull_request_target to check out, install, build, or execute contributor-controlled code.
  • Do not expose secrets to fork PRs; do not add secrets unless a real integration requires them.
  • Pin third-party Actions to immutable commit SHAs (with a readable version comment) where practical, and document the update process.
  • Add sensible concurrency groups to cancel superseded PR runs without allowing unrelated workflows or branches to cancel one another.
  • Avoid unnecessary write tokens, self-hosted runners, caches, artifacts, or privileged follow-up workflows.

Dependency and workflow maintenance

  • Evaluate Dependabot version updates for GitHub Actions and, once a dependency manifest exists, the project's actual package ecosystem.
  • Configure a reasonable update cadence and grouping strategy that avoids noisy PR floods.
  • Consider automated workflow lint/security analysis (for example, actionlint and zizmor) where it can be run and maintained reliably.
  • Add dependency review or vulnerability scanning only when the repository has dependencies and the selected feature is supported by the project/repository settings.
  • Consider CodeQL for Actions or application languages when code and supported analysis targets exist; do not enable empty/speculative scans.

Pull request hygiene and branch cleanup

  • Enable GitHub's native Automatically delete head branches repository setting after verifying the effect on contributor and fork workflows.
  • Prefer this native setting over a custom branch-deletion Action. Do not delete branches belonging to open PRs, protected branches, or branches that are still needed.
  • Review merge strategy and branch protection/rulesets for the default branch (required checks, conversation resolution, linear history or squash policy, and who may bypass rules); recommend changes rather than weakening contributor access.
  • Keep PR templates and issue forms aligned with actual automated checks and contributor instructions.

Future automation (only when justified)

  • Define clear conditions for adding release/tag automation once a real versioned CLI/package exists.
  • Consider changelog/release-note automation, artifact publishing, scheduled health checks, or stale-issue automation only after documenting their value, permissions, failure modes, and maintenance cost.
  • Do not auto-close issues/PRs or auto-merge dependency updates without an explicit, reviewed policy.

Phase 3 — Verification and documentation

  • Validate every workflow file (YAML syntax and GitHub Actions expressions/schema) with appropriate tooling.
  • Verify triggers, permissions, fork PR behavior, path filters, concurrency, and failure propagation.
  • Open a test PR and confirm the expected checks run; verify a deliberately failing check produces a failing status.
  • Confirm documentation-only changes remain easy to contribute and no unavailable app/test command is invoked.
  • Document the local equivalents of CI checks, workflow responsibilities, required secrets (ideally none for baseline CI), and how to troubleshoot failed runs in CONTRIBUTING.md or a concise linked document.
  • Update the README/roadmap only if the automation materially changes contributor instructions or project status.
  • Summarize what was implemented, what was intentionally deferred, and why.

Acceptance criteria

  • A research/audit note exists before workflow implementation and reflects the current repository, not a generic template.
  • The repository has one coherent, working CI setup; issue Run the local checks in GitHub Actions #14 is incorporated without duplicated or conflicting checks.
  • All active workflows use least-privilege permissions and safe handling of fork PRs.
  • Automated branch cleanup is configured through GitHub's native setting where available, with no unsafe custom deletion workflow.
  • Dependency/action update automation is configured only for ecosystems that exist and is documented.
  • All active workflows pass validation and at least one real PR run is verified.
  • Contributor documentation explains the checks and how to run equivalent commands locally.
  • Deferred automation is listed with clear prerequisites rather than implemented speculatively.

Important implementation constraints

  • Research first, implementation second. The implementer should inspect current GitHub documentation and repository settings before deciding on triggers, permissions, action versions, and settings.
  • Do not add application build/test jobs until the relevant project commands exist.
  • Keep workflows small, composable, readable, and maintainable. Avoid unnecessary bots and third-party Actions.
  • Never place credentials or secrets in repository files, logs, PR comments, or untrusted workflow contexts.
  • Prefer native GitHub repository features over custom Actions when they solve the problem more safely.
  • Keep this issue focused on GitHub/Git automation; it does not authorize implementation of DocHeal product features.

Research references

Activity

  1. added
    architecture
    on Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

architecture

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions