Fix syntax error pr labeler#40
Conversation
|
@sehmaluva Hi, SyntaxError: unexpected token 'catch' has been fixed, the script now runs and correctly generates label. |
The .idea directory is still tracked in all your PR. So can you fix that. then i will test your changes |
📋 Description
This PR fixes a SyntaxError in .github/workflows/pr-labeler.yml that was causing the PR Auto Labeler workflow to fail on every pull request.
What type of contribution is this?
What does this PR do?
This PR fixes a SyntaxError: Unexpected token 'catch' in .github/workflows/pr-labeler.yml.
The script for detecting first time contributors contained two different implementations that had been accidentally merged together, leaving an orphaned catch block without a matching try block and referencing two undefined variables (prAuthor and authorPRs).
This fix removes the duplicate code and keeps a single, correct implementation: prAuthor is now properly defined from context.payload.pull_request.user.login and the logic is wrapped in a proper try/catch block.
Related Issue
🎯 For Beginners: Step-by-Step Guide
Before Submitting
✅ I have tested my changes locally
✅ I have followed the project guidelines
✅ I have updated documentation (if needed)
Need Help?
🧪 Testing
How to test this PR?
Test Results
📸 Screenshots / Demo
Before
After
📝 Checklist
Code Quality
Documentation
/docsTesting & Validation
Git & Commit
🎓 For Different Contribution Types
📱 Profile Contributions
Profile Checklist
docs/templates/PROFILE_TEMPLATE.mdprofiles/YOUR_GITHUB_USERNAME.mdProfile Tips
🧩 Challenge Solutions
Challenge Checklist
challenges/level/challenge-name/)Challenge Tips
🚀 Project Contributions
Project Checklist
Project Tips
📝 Documentation
Documentation Checklist
Documentation Tips
🌟 Additional Information
What I learned while working on this:
How a single orphaned catch block without a matching try can break an entire github actions workflow with a SyntaxError, even though the rest of the script logic looks fine.
Challenges I faced:
Questions for reviewers:
📚 Resources I Used
💬 Notes for Reviewers