Skip to content

Fix syntax error pr labeler#40

Open
Nonoka-T wants to merge 3 commits into
sehmaluva:mainfrom
Nonoka-T:fix-syntax-error-pr-labeler
Open

Fix syntax error pr labeler#40
Nonoka-T wants to merge 3 commits into
sehmaluva:mainfrom
Nonoka-T:fix-syntax-error-pr-labeler

Conversation

@Nonoka-T

Copy link
Copy Markdown
Contributor

📋 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?

  • 👤 Profile (Adding or updating a student profile)
  • 🧩 Challenge (Solving a coding challenge)
  • 🚀 Project (Building a new project or feature)
  • 📜 Script (Adding a helpful script or tool)
  • 📝 Documentation (Improving docs, README, or guides)
  • 🐛 Bug Fix (Fixing an issue)
  • ✨ Enhancement (Improving existing functionality)
  • 🎨 Design (UI/UX improvements)

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

  1. ✅ I have tested my changes locally

    • Run your code to make sure it works
    • Check for any errors or warnings
  2. ✅ I have followed the project guidelines

  3. ✅ I have updated documentation (if needed)

    • Updated README if adding new features
    • Added comments to complex code
    • Created/updated any relevant docs

Need Help?

  • 💬 Ask questions in the comments below
  • 📖 Read the guides in docs/guides/
  • 🆘 Tag a maintainer with @mention if stuck
  • 🎓 Check our FAQ for common issues

🧪 Testing

How to test this PR?

  • Open this pull request
  • Check the PR Auto Labeler / label-pr workflow in the Actions tab
  • Confirm the workflow completes successfully and adds labels to the PR

Test Results

Paste test output here

📸 Screenshots / Demo

Before

After


📝 Checklist

Code Quality

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings or errors
  • I have checked for and fixed any typos

Documentation

  • I have updated the README (if applicable)
  • I have added/updated comments in my code
  • I have updated relevant documentation in /docs
  • My profile follows the template (for profile contributions)

Testing & Validation

  • I have tested my changes locally
  • I have added tests that prove my fix/feature works (if applicable)
  • All existing tests pass with my changes
  • I have checked that my changes don't break other features

Git & Commit

  • My branch is up to date with the main branch
  • I have used clear, descriptive commit messages
  • I have squashed any unnecessary commits
  • My PR title clearly describes what this PR does

🎓 For Different Contribution Types

📱 Profile Contributions

Profile Checklist

  • Used the profile template from docs/templates/PROFILE_TEMPLATE.md
  • File is named profiles/YOUR_GITHUB_USERNAME.md
  • Included your name, school, and interests
  • Profile is professional and respectful
  • No personal sensitive information included

Profile Tips

  • ✅ Be authentic and showcase your personality
  • ✅ Include your learning goals
  • ✅ Mention technologies you're interested in
  • ✅ Add a fun fact about yourself
  • ❌ Don't include email, phone, or address
  • ❌ Don't use offensive language
🧩 Challenge Solutions

Challenge Checklist

  • My solution is in the correct directory (challenges/level/challenge-name/)
  • I have included clear comments explaining my approach
  • My solution handles edge cases
  • I have tested with different inputs
  • My code follows the challenge requirements

Challenge Tips

  • ✅ Explain your thought process in comments
  • ✅ Consider time and space complexity
  • ✅ Test with edge cases (empty inputs, large numbers, etc.)
  • ✅ Write clean, readable code
  • ❌ Don't just copy solutions from the internet
  • ❌ Don't submit untested code
🚀 Project Contributions

Project Checklist

  • Project has a clear README with setup instructions
  • All dependencies are documented
  • Code is organized and well-structured
  • Project follows the directory structure guidelines
  • Includes examples or demo (if applicable)

Project Tips

  • ✅ Include a demo or screenshots
  • ✅ Write clear setup/installation steps
  • ✅ Add error handling
  • ✅ Make it beginner-friendly
  • ✅ Include a "How to Use" section
  • ❌ Don't commit node_modules, .env, or build artifacts
  • ❌ Don't include sensitive data or API keys
📝 Documentation

Documentation Checklist

  • Writing is clear and easy to understand
  • Grammar and spelling are correct
  • Links are working and relevant
  • Examples are included where helpful
  • Follows the project's documentation style

Documentation Tips

  • ✅ Write for beginners
  • ✅ Use examples to clarify complex topics
  • ✅ Break content into sections with headers
  • ✅ Include code blocks with proper syntax highlighting
  • ❌ Don't assume prior knowledge
  • ❌ Don't use overly technical jargon without explanation

🌟 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


@Nonoka-T

Copy link
Copy Markdown
Contributor Author

@sehmaluva Hi, SyntaxError: unexpected token 'catch' has been fixed, the script now runs and correctly generates label.
However, it now fails with 403 Resource not accessible by integration error when trying to apply the labels. This appears to be permission issue with Github actions on forked PRs which is outside the scope of this fix.

@sehmaluva

Copy link
Copy Markdown
Owner

@sehmaluva Hi, SyntaxError: unexpected token 'catch' has been fixed, the script now runs and correctly generates label. However, it now fails with 403 Resource not accessible by integration error when trying to apply the labels. This appears to be permission issue with Github actions on forked PRs which is outside the scope of this fix.

The .idea directory is still tracked in all your PR. So can you fix that. then i will test your changes

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.

[BUG] - SyntaxError in pr-labeler.yml causes "PR Auto Labeler" workflow to fail on every PR

2 participants