Skip to content

Latest commit

 

History

History
67 lines (51 loc) · 1.94 KB

development.md

File metadata and controls

67 lines (51 loc) · 1.94 KB

🔍 Neon Schema Diff Action Development

Development template from https://github.com/actions/typescript-action.

Initial Setup

After you've cloned the repository to your local machine or codespace, you'll need to perform some initial setup steps before you can develop your action.

Note

You'll need to have a reasonably modern version of Node.js handy (20.x or later should work!). If you are using a version manager like nodenv or nvm, this template has a .node-version file at the root of the repository that will be used to automatically switch to the correct version when you cd into the repository. Additionally, this .node-version file is used by GitHub Actions in any actions/setup-node actions.

  1. 🛠️ Install the dependencies

    bun install
  2. 🏗️ Package the TypeScript for distribution

    bun run bundle
  3. ✅ Run the tests

    $ bun run test
    
    PASS  ./index.test.js
     index
       ✓ calls run when imported (3 ms)
    
    PASS __tests__/main.test.ts
     action
       ✓ invalid api host (2 ms)
       ✓ invalid database input (1 ms)
       ✓ valid inputs (11 ms)
    
    PASS __tests__/diff.test.ts
     diff
       ✓ should throw an error if the project does not exist (9 ms)
       ✓ should throw an error if the branch is not found (1 ms)
       ✓ should throw an error if the branch has no parent
       ✓ works with valid project and branch (2 ms)
    ...
  4. ✅ Run the action locally with local-action

    $ cp .env.example .env
    # modify your environment variables
    $ bun run local-action

    Currently, the action skips the create comment part, in the future we can have a specific repository to test this flow entirely in the CI.