Skip to content

Enhance reusable workflows#80

Open
Yaswant Pradhan (yaswant) wants to merge 166 commits into
mainfrom
develop
Open

Enhance reusable workflows#80
Yaswant Pradhan (yaswant) wants to merge 166 commits into
mainfrom
develop

Conversation

@yaswant

@yaswant Yaswant Pradhan (yaswant) commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

PR Summary

Code Reviewer: James Bruten (@james-bruten-mo)

Hardens the GitHub Actions security baseline across all workflows.

Action pinning

  • All third-party actions replaced with immutable 40-char commit SHAs (e.g. actions/checkout@v6@df4cb1c…).
  • actions/github-script in track-review-project.yaml upgraded from v8 → v9 as part of the pin.

Credential & permission scoping

  • persist-credentials: false added to every actions/checkout step
  • Top-level permissions: {} set on caller workflows; granular contents: read / pull-requests: write / actions: read pushed down to job level in call-track-review-project.yaml, call-trigger-project-workflow.yaml, and trigger-project-workflow.yaml
  • fortran-lint.yaml gains an explicit contents: read job permission.

Template-injection fixes (zizmor)

  • cla-check.yaml: step outputs and inputs.cla-url moved to env: vars, read via process.env.* in the github-script block.
  • fortran-lint.yaml: all string/path inputs moved to env: vars; boolean flags resolved in shell using a bash array.
  • track-review-project.yaml: inputs.project_org and inputs.project_number moved to env: vars. Also, included PROJECT_ACTION_PAT secret as required parameter to avoid secret inheritance in caller workflow (breaking change! See updated README for usage).

CLA workflow logic

  • Merge-ref detection replaced: git ls-remote → gh api repos/.../pulls/… (avoids unauthenticated git network call).
  • CONTRIBUTORS.md modification check rewritten: git diff → GitHub Contents API + base64 | tr | cmp (avoids authenticated git fetch from fork). File modification now checked against content instead of just file state.

Tooling & config

  • New dependabot.yaml: monthly schedule, major-version updates blocked, all action updates grouped into a single PR
  • New zizmor.yaml: suppresses unpinned-uses, dangerous-triggers, and secrets-inherit for the two caller workflows that use secrets: inherit
  • .yamllint: updated ignore syntax; added comments and comments-indentation rules.
  • PR template: minor formatting tidy-up, emoji section headers, few typo fixes.

To enforce strict GitHub Actions security baselines, we now use immutable 40-character commit SHAs.

✅ Code Quality Checklist

(Some checks are automatically carried out via the CI pipeline)

  • I have performed a self-review of my own code
  • My code follows the project's style guidelines
  • The modified workflow's README has been updated, if required
  • The changes have been sufficiently tested (see MetOffice/git_playground/pull/137)

🤖 AI Assistance and Attribution

  • Some of the content of this change has been produced with the assistance of Generative AI tool name (e.g., Met Office Github Copilot Enterprise, Github Copilot Personal, ChatGPT GPT-4, etc) and I have followed the Simulation Systems AI policy (including attribution labels)

💻 Code Review

  • The changes are approriate and testing has been sufficient

Co-authored-by: Yaswant Pradhan <2984440+yaswant@users.noreply.github.com>
@yaswant Yaswant Pradhan (yaswant) changed the title Pin third party actions Enhance reusable workflows Jun 8, 2026
- Set 'requirements' in build-sphinx-docs.yaml to optional
- Update output redirection syntax in cla-check.yaml, sphinx-docs.yaml, and track-review-project.yaml for consistency
- Add Actionlint, Zizmor, and Markdown Lint steps to validate workflows in validate.yaml
- Change shell from Python to Bash in labeler action for input validation
- Update pyproject.toml to include new dependencies and configure Markdown Lint settings
- Improve formatting and clarity in README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI security Changes to prevent code vulnerabilities

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Security hardening: Pin third-party actions to immutable commit SHAs

3 participants