fairdataihub / codefair-app

Your coding assistant to make research software reusable without breaking a sweat!
https://codefair.io
MIT License
7 stars 2 forks source link

fix: 🐛 patches for zenodo workflow #86

Closed megasanjay closed 1 month ago

megasanjay commented 1 month ago

Summary by Sourcery

Fix issues in the Zenodo workflow by correcting conditional checks and database update logic. Enhance logging and metadata handling to improve process transparency and reliability.

Bug Fixes:

Enhancements:

fairdataihub-bot[bot] commented 1 month ago

Thank you for submitting this pull request! We appreciate your contribution to the project. Before we can merge it, we need to review the changes you've made to ensure they align with our code standards and meet the requirements of the project. We'll get back to you as soon as we can with feedback. Thanks again!

sourcery-ai[bot] commented 1 month ago

Reviewer's Guide by Sourcery

This pull request implements several bug fixes and improvements to the Zenodo workflow, focusing on error handling, data consistency, and user interface enhancements. The changes span across multiple files in the bot and UI components of the application.

Sequence diagram for pull request opened event handling

sequenceDiagram
    actor User
    participant App
    participant DB as Database
    participant Console

    User->>App: Open pull request
    App->>DB: Check installation action count
    alt Action count > 0
        App->>Console: Log "Action limit still applied, ignoring..."
        App-->>User: Return
    end

    App->>DB: Update licenseRequest
    alt Update fails
        App->>Console: Log "Error updating the license request PR URL"
        App-->>User: Return
    else Update succeeds
        App->>Console: Log "License PR badge added to the issue body"
        App->>App: Append license PR badge to issue body
    end

    App->>DB: Update codeMetadata
    alt Update fails
        App->>Console: Log "Error updating the code metadata PR URL"
        App-->>User: Return
    else Update succeeds
        App->>App: Append metadata PR badge to issue body
    end

    App->>App: Update issue with new body
    App-->>User: Issue updated

Updated class diagram for database operations

classDiagram
    class DB {
        +updateLicenseRequest(data)
        +updateCodeMetadata(data)
        +findUniqueCodeMetadata(repository_id)
    }

    class App {
        +handlePullRequestOpened()
        +handlePullRequestClosed()
    }

    DB <|-- App : uses

    class Console {
        +info(message)
        +error(message)
    }

    App <|-- Console : logs

    class Context {
        +payload
        +octokit
    }

    App <|-- Context : uses

    class Issue {
        +createIssue(owner, repository, title, body)
    }

    App <|-- Issue : updates

File-Level Changes

Change Details Files
Improved error handling and logging in the bot's pull request handling
  • Added null checks for the installation object
  • Implemented error logging for license request and code metadata updates
  • Added consola.info logs for better debugging
bot/index.js
Enhanced the pull request closed event handler
  • Added logic to verify if the PR was generated by the bot
  • Implemented issue body updates when PRs are closed
  • Improved error handling for database operations
bot/index.js
Updated metadata handling in the bot
  • Modified the updateMetadataIdentifier function to update existing metadata
  • Improved error handling for database operations
bot/metadata/index.js
Enhanced the code metadata UI page
  • Added a development mode toggle for debugging
  • Improved form value initialization
ui/pages/add/code-metadata/[identifier].vue
Updated the Zenodo release page in the UI
  • Commented out development-related code
  • Uncommented the navigation to dashboard function
ui/pages/dashboard/[owner]/[repo]/release/zenodo.vue
Fixed typos and improved error handling in utility functions
  • Corrected a typo in the renderIssues function
  • Added logging for Zenodo deposition info
bot/utils/renderer/index.js
bot/archival/index.js
Removed sensitive data from API response
  • Removed the Zenodo token from the API response
ui/server/api/[owner]/[repo]/release/zenodo/index.get.ts

Tips and commands #### Interacting with Sourcery - **Trigger a new review:** Comment `@sourcery-ai review` on the pull request. - **Continue discussions:** Reply directly to Sourcery's review comments. - **Generate a GitHub issue from a review comment:** Ask Sourcery to create an issue from a review comment by replying to it. - **Generate a pull request title:** Write `@sourcery-ai` anywhere in the pull request title to generate a title at any time. - **Generate a pull request summary:** Write `@sourcery-ai summary` anywhere in the pull request body to generate a PR summary at any time. You can also use this command to specify where the summary should be inserted. #### Customizing Your Experience Access your [dashboard](https://app.sourcery.ai) to: - Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others. - Change the review language. - Add, remove or edit custom review instructions. - Adjust other review settings. #### Getting Help - [Contact our support team](mailto:support@sourcery.ai) for questions or feedback. - Visit our [documentation](https://docs.sourcery.ai) for detailed guides and information. - Keep in touch with the Sourcery team by following us on [X/Twitter](https://x.com/SourceryAI), [LinkedIn](https://www.linkedin.com/company/sourcery-ai/) or [GitHub](https://github.com/sourcery-ai).
fairdataihub-bot[bot] commented 1 month ago

Thanks for making updates to your pull request. Our team will take a look and provide feedback as soon as possible. Please wait for any GitHub Actions to complete before editing your pull request. If you have any additional questions or concerns, feel free to let us know. Thank you for your contributions!

fairdataihub-bot[bot] commented 1 month ago

Thanks for closing this pull request! If you have any further questions, please feel free to open a new issue. We are always happy to help!