Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Sep 11, 2025

The stale workflow was failing due to insufficient permissions for the reusable workflow at cpp-linter/.github/.github/workflows/stale.yml@main.

Error:

Invalid workflow file: .github/workflows/stale.yml#L9
The workflow is not valid. .github/workflows/stale.yml (Line: 9, Col: 3): Error calling workflow 'cpp-linter/.github/.github/workflows/stale.yml@main'. The nested job 'stale' is requesting 'contents: read, pull-requests: write', but is only allowed 'contents: none, pull-requests: none'.

Root Cause:
The calling workflow only provided issues: write permission at the workflow level, but the reusable workflow's job requires contents: read and pull-requests: write permissions that weren't being inherited.

Solution:
Following security best practices with the principle of least privilege:

  1. Set workflow-level permissions to empty (permissions: {})
  2. Add job-level permissions specifically for the stale job with required access:
    • contents: read - Required by the reusable workflow
    • issues: write - Maintained existing functionality
    • pull-requests: write - Added missing permission that was causing the failure

This change ensures the reusable workflow has the necessary permissions while maintaining security through job-level permission scoping.

Fixes #128.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copy link
Contributor Author

Copilot AI commented Sep 11, 2025

@shenxianpeng 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs.

I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review.

@github-actions github-actions bot added the bug Something isn't working label Sep 11, 2025
Copy link

@Copilot Copilot AI changed the title [WIP] fix: update stale workflow permissions for reusable workflow compatibility fix: update stale workflow permissions for reusable workflow compatibility Sep 11, 2025
@Copilot Copilot AI requested a review from shenxianpeng September 11, 2025 08:31
Copilot finished work on behalf of shenxianpeng September 11, 2025 08:31
@shenxianpeng shenxianpeng marked this pull request as ready for review September 11, 2025 08:50
@shenxianpeng shenxianpeng merged commit 83fc1af into main Sep 11, 2025
10 of 11 checks passed
@shenxianpeng shenxianpeng deleted the copilot/fix-128 branch September 11, 2025 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fix: update stale workflow permissions for reusable workflow compatibility
2 participants