fix(ci): Add secure PR labeler workflow with v5 config #2
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Overview
Implements an automated PR labeling workflow using GitHub Actions, based on the approach in PanagiotisDrakatos/HCE_v33_final_allinone_ready#32, with critical security fixes and improvements.
Changes
.github/labeler.yml: Labeler configuration using actions/labeler@v5 schema with array matchers.github/workflows/pr-labeler.yml: GitHub Actions workflow for automatic PR labeling.github/README.md: Documentation explaining security considerations and available labelsSecurity Improvements
This implementation addresses several security concerns identified in the original PR:
1. Event Type:
pull_requestinstead ofpull_request_targetThe original implementation used
pull_request_targetwith explicit checkout of PR code, which creates a security vulnerability:This allows malicious PRs to execute untrusted code with write permissions and access to repository secrets.
Our implementation uses the safer
pull_requestevent:Benefit: The workflow runs in the context of the merge commit with restricted permissions, preventing malicious code execution.
2. Fork Compatibility
The original checkout configuration would fail for forked PRs because
github.event.pull_request.head.shadoesn't exist in the base repository. Our implementation works seamlessly with both same-repo and forked PRs.3. Code Documentation
Added inline comment explaining the 200-line debug output limit to avoid confusion about the "magic number":
Available Labels
The workflow automatically applies labels based on changed files:
api,bloom-filter,config,consensus,core,crypto,distributed-ledger,erasure-code,network,protocol,shared-resources,trie,utildocumentation,ci,docker,build,testsTesting
YAML syntax validated successfully:
The workflow will automatically run on all PRs (opened, synchronized, reopened, or marked ready for review) and apply appropriate labels based on the files changed.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.