Skip to content

Improve error handling in create-labels workflow#30

Merged
Chris-Wolfgang merged 2 commits intogithub-folder-changesfrom
copilot/sub-pr-27-another-one
Dec 18, 2025
Merged

Improve error handling in create-labels workflow#30
Chris-Wolfgang merged 2 commits intogithub-folder-changesfrom
copilot/sub-pr-27-another-one

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 18, 2025

Description

Enhanced error handling in the create-labels.yaml workflow to distinguish between expected label-already-exists scenarios and actual failures (authentication, rate limiting, API errors).

Changes:

  • Check error status 422 and already_exists code before ignoring
  • Log informational messages when labels exist
  • Re-throw non-duplicate errors to surface real issues

Before:

catch (error) {
  // Ignore if label already exists
}

After:

catch (error) {
  if (error.status === 422 && error.response?.data?.errors?.[0]?.code === 'already_exists') {
    console.log('Label "dependabot - security" already exists, skipping creation');
  } else {
    console.error('Failed to create label "dependabot - security":', error.message);
    throw error;
  }
}

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Refactor

How Has This Been Tested?

  • YAML syntax validation
  • Error handling logic review
  • Workflow structure verification

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Screenshots (if applicable)

N/A - GitHub Actions workflow change

Additional context

Addresses feedback from PR #27 review comment about silent error handling masking real issues.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

- Check error status and only ignore 'already_exists' errors (422)
- Log error messages for authentication, rate limiting, and API issues
- Re-throw non-already-exists errors to fail the workflow properly

Co-authored-by: Chris-Wolfgang <210299580+Chris-Wolfgang@users.noreply.github.com>
Copilot AI changed the title [WIP] WIP Address feedback on .github folder updates Improve error handling in create-labels workflow Dec 18, 2025
Copilot AI requested a review from Chris-Wolfgang December 18, 2025 00:29
@Chris-Wolfgang Chris-Wolfgang marked this pull request as ready for review December 18, 2025 01:12
@Chris-Wolfgang Chris-Wolfgang merged commit eeb2f08 into github-folder-changes Dec 18, 2025
@Chris-Wolfgang Chris-Wolfgang deleted the copilot/sub-pr-27-another-one branch December 18, 2025 01:16
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.

2 participants