Skip to content

Commit 9ce9b2f

Browse files
authored
Auto commit indices changes with GitHub actions (#16)
2 parents 81b5986 + b5033b8 commit 9ce9b2f

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

.github/workflows/ci.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,16 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- name: Checkout repository
17+
if: github.event_name != 'pull_request'
1718
uses: actions/checkout@v4
1819

20+
- name: Checkout PR branch
21+
if: github.event_name == 'pull_request'
22+
uses: actions/checkout@v4
23+
with:
24+
ref: ${{ github.event.pull_request.head.ref }}
25+
token: ${{ secrets.BOT_GH_TOKEN }}
26+
1927
- name: Setup Node.js
2028
uses: actions/setup-node@v4
2129
with:
@@ -32,6 +40,23 @@ jobs:
3240
- name: Build
3341
run: npm run build
3442

43+
- name: Check uncommitted indices
44+
id: uncommitted_indices
45+
if: github.event_name == 'pull_request'
46+
run: |
47+
echo "has_changes=$([ -n "$(git diff --name-only HEAD "**/index.ts")" ] && echo "true" || echo "false")" >> $GITHUB_OUTPUT
48+
49+
- name: Commit indices
50+
if: github.event_name == 'pull_request' && steps.uncommitted_indices.outputs.has_changes == 'true'
51+
run: |
52+
echo "${{ secrets.BOT_PGP_KEY }}" | gpg --import --batch
53+
git config --global user.signingkey "[email protected]"
54+
git config --global user.name "Cloudnode [bot]"
55+
git config --global user.email "[email protected]"
56+
git add "**/index.ts"
57+
git commit -S -m "chore: update indices"
58+
git push
59+
3560
- name: Pack
3661
run: npm pack
3762

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* Auto-generated by generateIndices.sh */
22
export * from "./Request.js";
3-
export * from "./ServerErrorRegistry.js";
43
export * from "./Server.js";
4+
export * from "./ServerErrorRegistry.js";
55
export * from "./response/index.js";
66
export * from "./routing/index.js";

src/routing/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/* Auto-generated by generateIndices.sh */
2-
export * from "./RouteRegistry.js";
2+
export * from "./EndpointRoute.js";
33
export * from "./Route.js";
4+
export * from "./RouteRegistry.js";

0 commit comments

Comments
 (0)