Skip to content
This repository has been archived by the owner on Feb 27, 2024. It is now read-only.

Update READMEs #18

Merged
merged 2 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# GitHub Actions from Autoblocks

* [`replay`](./replay/README.md) - Replay Autoblocks events through your LLM application
* [`neon`](./neon/README.md) - Actions for creating and deleting [Neon branches](https://neon.tech/docs/introduction/branching)
106 changes: 104 additions & 2 deletions neon/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

# Neon Branching in GitHub Actions

These actions allow you to easily manage [Neon branches](https://neon.tech/docs/introduction/branching) as you make changes in your repository. Usage is as simple as:
These actions allow you to easily manage [Neon branches](https://neon.tech/docs/introduction/branching) within your GitHub Actions workflows. Usage is as simple as:

```yaml
name: CI
Expand Down Expand Up @@ -57,7 +57,7 @@ This project provides two actions:

**`create-branch`**:

This action creates a Neon branch for the current GitHub branch and commit. The Neon branch name will be the GitHub branch name plus the first seven characters of the commit SHA. For example, if you create a branch called `feat/my-feature` and push three commits, the following Neon branches will be created:
This action creates a Neon branch for the current GitHub branch and commit. The Neon branch name will be the GitHub branch name plus the first seven characters of the commit SHA. For example, if you create a GitHub branch called `feat/my-feature` and push three commits, the following Neon branches will be created:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would saying git branch be more correct than GitHub branch?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm yeah i only added this to be clear when i'm talking about neon branches vs github branches. i think it's fine, since this is a github-specific thing and not something that would work just b/c you're using git. technically github has their own concept of a branch (on top of git branches)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good!


- `feat/my-feature-61b5d0a`
- `feat/my-feature-ff2a8ea`
Expand All @@ -69,6 +69,108 @@ The Neon branch that is created always branches off of your primary Neon branch.

This action deletes all Neon branches associated with the deleted GitHub branch. From the example above, when you delete the `feat/my-feature` branch either directly or by merging its pull request (and have your repository set up to automatically delete branches when pull requests are merged), then the three Neon branches will be deleted.

## Supported Events

The supported events are:

- `push`
- `pull_request`
- `delete`

The branch name is determined automatically from the event. For `push` and `pull_request` events, the branch name is the name of the branch that was pushed or the name of the branch that the pull request is for. For `delete` events, the branch name is the name of the branch that was deleted.

Note that you can use any combination of these events to create and delete Neon branches:

- Create branches on `push`
- Delete branches on `delete`

```yaml
name: CI
on: push
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: autoblocksai/actions/neon/create-branch@v1
with:
api-key: ${{ secrets.NEON_API_KEY }}
project-id: ${{ vars.NEON_PROJECT_ID }}
```

```yaml
name: Cleanup
on: delete
jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- uses: autoblocksai/actions/neon/delete-branches@v1
with:
api-key: ${{ secrets.NEON_API_KEY }}
project-id: ${{ vars.NEON_PROJECT_ID }}
```

- Create branches on `pull_request`
- Delete branches on `pull_request` (set `types` to `[closed]`)

```yaml
name: CI
on: pull_request
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: autoblocksai/actions/neon/create-branch@v1
with:
api-key: ${{ secrets.NEON_API_KEY }}
project-id: ${{ vars.NEON_PROJECT_ID }}
```

```yaml
name: Cleanup
on:
pull_request:
types:
- closed
jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- uses: autoblocksai/actions/neon/delete-branches@v1
with:
api-key: ${{ secrets.NEON_API_KEY }}
project-id: ${{ vars.NEON_PROJECT_ID }}
```

- Create branches on `pull_request`
- Delete branches on `delete`

```yaml
name: CI
on: pull_request
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: autoblocksai/actions/neon/create-branch@v1
with:
api-key: ${{ secrets.NEON_API_KEY }}
project-id: ${{ vars.NEON_PROJECT_ID }}
```

```yaml
name: Cleanup
on: delete
jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- uses: autoblocksai/actions/neon/delete-branches@v1
with:
api-key: ${{ secrets.NEON_API_KEY }}
project-id: ${{ vars.NEON_PROJECT_ID }}
```

## `create-branch`

### Inputs
Expand Down
2 changes: 2 additions & 0 deletions neon/create-branch/zdist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9050,6 +9050,8 @@ const getOrCreateBranch = (neon, neonBranchName) => __awaiter(void 0, void 0, vo
const setOutputsFromEndpoint = (endpoint) => {
const direct = endpoint.host;
const pooled = endpoint.host.replace(endpoint.id, `${endpoint.id}-pooler`);
console.log(`Direct host: ${direct}`);
console.log(`Pooled host: ${pooled}`);
actions.setOutput('direct-host', direct);
actions.setOutput('pooled-host', pooled);
};
Expand Down
2 changes: 2 additions & 0 deletions neon/src/create-branch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ const getOrCreateBranch = async (
const setOutputsFromEndpoint = (endpoint: Endpoint) => {
const direct = endpoint.host;
const pooled = endpoint.host.replace(endpoint.id, `${endpoint.id}-pooler`);
console.log(`Direct host: ${direct}`);
console.log(`Pooled host: ${pooled}`);
actions.setOutput('direct-host', direct);
actions.setOutput('pooled-host', pooled);
};
Expand Down