guibranco / BancosBrasileiros

🇧🇷 :bank: :clipboard: Brazilian banks list
https://guibranco.github.io/BancosBrasileiros/
The Unlicense
433 stars 164 forks source link

[FEATURE] Use QuickType to generate `schemas/DTO` files via `GitHub Actions` #268

Open guibranco opened 1 year ago

guibranco commented 1 year ago

Description

Implement a GitHub Actions workflow to automatically generate schemas and Data Transfer Object (DTO) files using QuickType. This will help keep our data models up-to-date and synchronized with our data sources, streamlining the development process.

Why We Need This

  1. Automation: Automatically generating schemas and DTO files ensures they are always up-to-date with the latest changes, reducing manual effort and the risk of inconsistencies.
  2. Consistency: Using a consistent tool like QuickType across the team helps maintain uniform data models and reduces errors.
  3. Efficiency: Integrating schema generation into our CI/CD pipeline will speed up development and ensure that data models are always accurate.

Tech Notes

  1. QuickType Integration:

    • QuickType can generate schemas and DTO files from JSON, TypeScript, or other data formats.
    • We need to set up QuickType to run as part of our GitHub Actions workflow.
  2. GitHub Actions Workflow Setup:

    • Create a new workflow file in .github/workflows directory, e.g., generate-schemas.yml.
    • Define a job in the workflow to install QuickType and run it to generate the required files.
  3. Workflow File Example:

    name: Generate Schemas/DTO Files
    
    on:
     push:
       branches:
         - main
     pull_request:
       branches:
         - main
    
    jobs:
     generate:
       runs-on: ubuntu-latest
    
       steps:
         - name: Checkout code
           uses: actions/checkout@v3
    
         - name: Set up Node.js
           uses: actions/setup-node@v3
           with:
             node-version: "14"
    
         - name: Install QuickType
           run: npm install -g quicktype
    
         - name: Generate Schemas/DTO Files
           run: quicktype -s json -o src/schemas.ts data/example.json
    
         - name: Commit generated files
           run: |
             git config --global user.name 'GitHub Actions'
             git config --global user.email 'actions@github.com'
             git add src/schemas.ts
             git commit -m 'Update generated schemas/DTO files'
             git push
  4. QuickType Command Details:

    • Customize the quicktype command based on your data source and output requirements.
    • Refer to QuickType CLI documentation for additional options and configurations.
  5. File Management:

    • Ensure that the generated files are correctly placed in the repository and managed according to your project’s file structure.
    • Set up .gitignore if there are any temporary files or outputs that should not be committed.

Additional Notes

gitauto-ai[bot] commented 3 days ago

Hey, I'm a bit lost here! Not sure which file I should be fixing. Could you give me a bit more to go on? Maybe add some details to the issue or drop a comment with some extra hints? Thanks!

Have feedback or need help? Feel free to email info@gitauto.ai.