Skip to content

Chore: [AEA-0000] - add pre-commit hooks, update docs, tighten security on workflows#9

Merged
anthony-nhs merged 3 commits intomainfrom
update_docs
Apr 1, 2026
Merged

Chore: [AEA-0000] - add pre-commit hooks, update docs, tighten security on workflows#9
anthony-nhs merged 3 commits intomainfrom
update_docs

Conversation

@anthony-nhs
Copy link
Copy Markdown
Collaborator

@anthony-nhs anthony-nhs commented Apr 1, 2026

Summary

  • Routine Change

Details

  • add pre-commit hooks
  • update example in docs
  • tighten security on workflows
  • add workflow to update devcontainer version

Copilot AI review requested due to automatic review settings April 1, 2026 10:53
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

This PR is linked to a ticket in an NHS Digital JIRA Project. Here's a handy link to the ticket:

AEA-0000

@anthony-nhs anthony-nhs merged commit f9edb8e into main Apr 1, 2026
9 checks passed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces local development tooling (Poetry + pre-commit) and tightens GitHub Actions permissions to follow a least-privilege posture, alongside a small README workflow example update.

Changes:

  • Add Poetry configuration/lockfile and wire make install to install pre-commit hooks.
  • Add a pre-commit configuration for basic repo hygiene checks plus local lint/security hooks.
  • Restrict GitHub Actions default token permissions via permissions: {} and explicit per-job permissions.

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
README.md Updates the example workflow YAML to use an explicit permissions: {} default.
pyproject.toml Adds Poetry project configuration and pre-commit as a dev dependency.
poetry.toml Configures Poetry virtualenv behavior (in-project, prefer active Python).
poetry.lock Locks the dev dependency set (pre-commit and transitive deps).
Makefile Updates install flow to run poetry install and install pre-commit hooks.
.pre-commit-config.yaml Adds pre-commit hooks (pre-commit-hooks, flake8, local system hooks).
.github/workflows/release.yml Adds restrictive default permissions and job-level permissions.
.github/workflows/pull_request.yml Adds restrictive default permissions and job-level permissions.
.github/workflows/ci.yml Adds restrictive default permissions and job-level permissions.
.gitallowed Adds an allowlist file intended for secret-scanning tooling.

Comment on lines +2 to +5
[project]
python = "^3.14"
name = "eps-copilot-instructions"

Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In PEP 621 metadata, [project] does not support a python key. If you intend to publish/validate metadata, this should be requires-python (e.g. requires-python = ">=3.14") or the entire [project] table should be removed so Poetry’s [tool.poetry.dependencies].python remains the single source of truth.

Suggested change
[project]
python = "^3.14"
name = "eps-copilot-instructions"

Copilot uses AI. Check for mistakes.
@@ -1,8 +1,11 @@
.PHONY: install install-node compile lint test
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.PHONY doesn’t include the newly added install-python and install-hooks targets. If files/directories with those names ever exist, make may treat them as up-to-date and skip running the recipes; add them to .PHONY to keep behavior consistent.

Suggested change
.PHONY: install install-node compile lint test
.PHONY: install install-node install-python install-hooks compile lint test

Copilot uses AI. Check for mistakes.
Comment on lines +15 to +50
- id: check-yaml
name: Check pipelines configuration
files: ^(.github)

- repo: https://github.com/pycqa/flake8
rev: "7ef0350a439c93166bc8ba89fcc3de6a9a664e6c"
hooks:
- id: flake8

- repo: local
hooks:
- id: zizmor-action
name: Check action.yml
entry: zizmor
args: ["action.yml"]
language: system
files: action.yml
pass_filenames: false

- id: lint-githubactions
name: Lint github actions
entry: make
args: ["actionlint"]
language: system
files: ^.github
types_or: [yaml]
pass_filenames: false

- id: lint-githubaction-scripts
name: Lint github action scripts
entry: make
args: ["shellcheck"]
language: system
files: ^.github/scripts
types_or: [sh, shell]
pass_filenames: false
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The files: regexes for .github paths use an unescaped . (e.g. ^.github), which matches any character. Escaping the dot and anchoring to a slash (e.g. ^\.github/) will avoid unintended matches outside the .github/ directory.

Copilot uses AI. Check for mistakes.
Comment on lines +24 to +33
- repo: local
hooks:
- id: zizmor-action
name: Check action.yml
entry: zizmor
args: ["action.yml"]
language: system
files: action.yml
pass_filenames: false

Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The local hooks zizmor and git-secrets use language: system, but neither tool is installed via poetry install (they’re not in pyproject.toml/poetry.lock) and the Makefile install flow doesn’t install them either. This will make pre-commit fail on fresh setups unless the tools are preinstalled; consider adding installation steps (or switching to pre-commit-managed hooks / documenting the required system dependencies).

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants