Skip to content

Commit

Permalink
refactor: 🎨 Initialize the rpc-env action
Browse files Browse the repository at this point in the history
Signed-off-by: Jonas Strassel <info@jonas-strassel.de>
  • Loading branch information
boredland committed Nov 1, 2024
1 parent 30774bc commit eebed61
Show file tree
Hide file tree
Showing 24 changed files with 57,276 additions and 527 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
on:
push:
branches:
- main

permissions:
contents: write
pull-requests: write

## require that test.yml ran

name: release-please
jobs:
release-please:
runs-on: ubuntu-latest
outputs:
releaseCreated: ${{ steps.release.outputs.release_created }}
steps:
- uses: googleapis/release-please-action@7987652d64b4581673a76e33ad5e98e3dd56832f # pin@v4.1.3
id: release
with:
release-type: node

release-node:
uses: bgd-labs/github-workflows/.github/workflows/release-node.yml@ea41920d7c7c656823137da415d1e3f59bf064bf # pin@main
if: ${{ needs.release-please.outputs.releaseCreated }}
needs: release-please
secrets:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
31 changes: 31 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# creates a new npm release
name: test

on:
pull_request:
push:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # pin@v4.2.1

- uses: bgd-labs/github-workflows/.github/actions/setup-node@main

- name: test lib
run: npm test -- --run

- name: test action
uses: ./
with:
ALCHEMY_API_KEY: ${{ secrets.ALCHEMY_API_KEY }}
env:
RPC_POLYGON: "https://rpc.polygon.com"

- name: test action (assertion)
run: |
test "${{env.RPC_POLYGON}}" = "https://rpc.polygon.com"
test "${{env.RPC_MAINNET}}" = "https://eth-mainnet.g.alchemy.com/v2/${{ secrets.ALCHEMY_API_KEY }}"
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Bored Ghosts

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Action: `action-rpc-env`

This action iterates over the supported chain ids and sets the corresponding env var.

## Inputs

### `ALCHEMY_API_KEY`

Alchemy API key

If given, the action substitute missing RPC_URLs with one constructed from the given key.

### Usage

```
- uses: bgd-labs/action-rpc-env@main
with:
ALCHEMY_API_KEY: ${{ secrets.ALCHEMY_API_KEY }}
env:
RPC_POLYGON: "https://rpc.polygon.com"
```
10 changes: 10 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: "rpc-env"
description: "Iterates over the supported chain ids and sets the corresponding env var"
inputs:
ALCHEMY_API_KEY:
description: "Alchemy API key"
required: false

runs:
using: "node20"
main: dist/action.js
56 changes: 28 additions & 28 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
{
"$schema": "https://biomejs.dev/schemas/1.9.3/schema.json",
"vcs": {
"enabled": false,
"clientKind": "git",
"useIgnoreFile": false
},
"files": {
"ignoreUnknown": false,
"ignore": []
},
"formatter": {
"enabled": true,
"indentStyle": "tab"
},
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
},
"javascript": {
"formatter": {
"quoteStyle": "double"
}
}
"$schema": "https://biomejs.dev/schemas/1.9.3/schema.json",
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
},
"files": {
"ignoreUnknown": false,
"ignore": ["dist"]
},
"formatter": {
"enabled": true,
"indentStyle": "space"
},
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
},
"javascript": {
"formatter": {
"quoteStyle": "double"
}
}
}
2 changes: 2 additions & 0 deletions dist/action.d.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

export { }
2 changes: 2 additions & 0 deletions dist/action.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

export { }
Loading

0 comments on commit eebed61

Please sign in to comment.