Skip to content

Conversation

@himanshusinghs
Copy link
Collaborator

@himanshusinghs himanshusinghs commented Nov 4, 2025

Proposed changes

Modifies the Github workflows (Code Health and Code Health from fork) to work with least privileges and fixes the accidental problem where dependabot created PRs and forked PRs were not being tested for the modified dependencies and PR contents.

Additionally, we don't persist Git credentials when not required.

Checklist

@himanshusinghs himanshusinghs requested a review from a team as a code owner November 4, 2025 13:56
Copilot AI review requested due to automatic review settings November 4, 2025 13:56
Copy link
Contributor

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 reconfigures GitHub Actions permissions following the principle of least privilege and fixes an issue preventing Dependabot PRs from being tested. The changes grant minimal required permissions (contents: read) and disable credential persistence to improve security, while also re-enabling code health checks for both Dependabot and fork PRs.

Key Changes:

  • Switched from empty permissions to explicit contents: read permission
  • Added persist-credentials: false to all checkout actions for security hardening
  • Changed code-health-fork.yml trigger from pull_request_target to pull_request and re-enabled fork PR testing

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
.github/workflows/code-health.yml Added explicit read permission and disabled credential persistence across all checkout steps
.github/workflows/code-health-fork.yml Changed trigger event, updated permissions, re-enabled fork testing, and disabled credential persistence

@himanshusinghs himanshusinghs changed the title chore: reconfigure permission model for Github actions chore: reconfigure permission model for Github actions MCP-279 Nov 4, 2025
@himanshusinghs himanshusinghs force-pushed the chore/ci-workflow-permission-mods branch from 5c1527d to 59b5372 Compare November 4, 2025 13:59
@coveralls
Copy link
Collaborator

coveralls commented Nov 4, 2025

Pull Request Test Coverage Report for Build 19110567098

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 80.149%

Totals Coverage Status
Change from base Build 19074925294: 0.0%
Covered Lines: 6477
Relevant Lines: 7972

💛 - Coveralls

---
name: Code Health (fork)
on:
pull_request_target:
Copy link
Collaborator

Choose a reason for hiding this comment

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

if we are changing this, do we need separated workflows for fork and non fork?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We already have separated workflows for both forks (code-health-fork.yml) and non-forks (code-health.yml). The problem earlier was that code-health-fork.yml was never testing the actual changes of the pull request because the workflow was triggered by pull_request_target trigger which was acting in the context of main branch and never checking out the pull request changes.

@himanshusinghs himanshusinghs force-pushed the chore/ci-workflow-permission-mods branch from 59b5372 to 0569695 Compare November 5, 2025 08:32
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.

4 participants