Skip to content

Commit 5493e7b

Browse files
chore: harden ci and refresh dependencies
1 parent 1793a95 commit 5493e7b

22 files changed

Lines changed: 357 additions & 233 deletions

.github/workflows/build.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build Artifact
1+
name: 03-build-artifact
22

33
on:
44
workflow_dispatch:
@@ -11,27 +11,28 @@ permissions:
1111

1212
jobs:
1313
build:
14+
name: 01-build-artifact
1415
runs-on: ubuntu-latest
1516
steps:
16-
- name: Checkout
17+
- name: 01-checkout
1718
uses: actions/checkout@v4
1819

19-
- name: Setup Tooling
20+
- name: 02-setup-tooling
2021
uses: jdx/mise-action@d6e32c1796099e0f1f3ac741c220a8b7eae9e5dd
2122
with:
2223
install: true
2324
cache: true
2425
experimental: true
2526
env:
2627
# Required for aqua-backed tool installs to avoid GitHub API rate limits in CI.
27-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
GITHUB_TOKEN: ${{ github.token }}
2829

29-
- name: Build
30+
- name: 03-build
3031
run: |
3132
mise run setup
3233
mise run build
3334
34-
- name: Upload dist artifact
35+
- name: 04-upload-dist-artifact
3536
uses: actions/upload-artifact@v4
3637
with:
3738
name: opencode-palantir-dist

.github/workflows/bundle.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Bundle Plugin (with data)
1+
name: 04-bundle-plugin-with-data
22

33
on:
44
workflow_dispatch:
@@ -8,28 +8,29 @@ permissions:
88

99
jobs:
1010
bundle:
11+
name: 01-bundle-plugin-with-data
1112
runs-on: ubuntu-latest
1213
steps:
13-
- name: Checkout
14+
- name: 01-checkout
1415
uses: actions/checkout@v4
1516

16-
- name: Setup Tooling
17+
- name: 02-setup-tooling
1718
uses: jdx/mise-action@d6e32c1796099e0f1f3ac741c220a8b7eae9e5dd
1819
with:
1920
install: true
2021
cache: true
2122
experimental: true
2223
env:
2324
# Required for aqua-backed tool installs to avoid GitHub API rate limits in CI.
24-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
GITHUB_TOKEN: ${{ github.token }}
2526

26-
- name: Build
27+
- name: 03-build
2728
run: |
2829
mise run setup
2930
mise run test
3031
mise run build
3132
32-
- name: Create bundle
33+
- name: 04-create-bundle
3334
run: |
3435
mkdir -p bundle
3536
cp -R dist bundle/dist
@@ -44,7 +45,7 @@ jobs:
4445
4546
tar -czf opencode-palantir-bundle.tgz -C bundle .
4647
47-
- name: Upload bundle
48+
- name: 05-upload-bundle
4849
uses: actions/upload-artifact@v4
4950
with:
5051
name: opencode-palantir-bundle

.github/workflows/pr-title.yml

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,36 @@
1-
name: 'LintPrTitle'
1+
name: 02-pr-title-validation
22

33
on:
4-
pull_request_target:
4+
pull_request:
55
types:
66
- opened
77
- edited
88
- synchronize
9+
- reopened
910

1011
permissions:
11-
pull-requests: write
12+
pull-requests: read
1213

1314
jobs:
14-
ValidatePrTitle:
15+
validate-title:
16+
name: 01-validate-title
1517
runs-on: ubuntu-latest
1618
steps:
17-
- uses: amannn/action-semantic-pull-request@v5
18-
env:
19-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
- name: 01-validate-pr-title
20+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
21+
with:
22+
script: |
23+
const title = context.payload.pull_request?.title ?? '';
24+
const conventionalCommitPattern = /^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\([A-Za-z0-9._/-]+\))?!?: .+/;
25+
26+
if (conventionalCommitPattern.test(title)) {
27+
core.info(`PR title is conventional: ${title}`);
28+
return;
29+
}
30+
31+
core.setFailed(
32+
[
33+
'PR title must follow Conventional Commits, e.g. "fix: handle empty docs snapshot" or "feat(cli): add setup command".',
34+
`Received: ${title || '<empty>'}`,
35+
].join('\n')
36+
);

.github/workflows/pr.yml

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,42 @@
1-
name: Pr
1+
name: 01-pr-validation
22

33
on:
44
pull_request:
5-
pull_request_target:
65
workflow_dispatch:
76

87
concurrency:
98
group: ${{ github.workflow }}-${{ github.ref }}
109
cancel-in-progress: true
1110

1211
permissions:
13-
actions: read
1412
contents: read
1513

1614
jobs:
17-
Check:
15+
check:
16+
name: 01-check
1817
runs-on: ubuntu-latest
1918
steps:
20-
- name: Checkout
19+
- name: 01-checkout
2120
uses: actions/checkout@v4
22-
with:
23-
ref: ${{ github.event.pull_request.head.sha || github.ref }}
2421

25-
- name: Setup Tooling
22+
- name: 02-setup-tooling
2623
uses: jdx/mise-action@d6e32c1796099e0f1f3ac741c220a8b7eae9e5dd
2724
with:
2825
install: true
2926
cache: true
3027
experimental: true
3128
env:
3229
# Required for aqua-backed tool installs to avoid GitHub API rate limits in CI.
33-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34-
35-
- name: Run Checks
36-
run: |
37-
mise run setup
38-
mise run lint
39-
mise run test
40-
mise run build
30+
GITHUB_TOKEN: ${{ github.token }}
31+
32+
- name: 03-install-dependencies
33+
run: mise run setup
34+
35+
- name: 04-lint
36+
run: mise run lint
37+
38+
- name: 05-test
39+
run: mise run test
40+
41+
- name: 06-build
42+
run: mise run build

.github/workflows/publish.yml

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Publish Package
1+
name: 07-publish-package
22

33
on:
44
workflow_dispatch:
@@ -19,48 +19,43 @@ permissions:
1919

2020
jobs:
2121
publish:
22+
name: 01-publish-package
2223
runs-on: ubuntu-latest
24+
if: github.ref == 'refs/heads/main'
2325
steps:
24-
- uses: actions/checkout@v4
26+
- name: 01-checkout
27+
uses: actions/checkout@v4
2528
with:
2629
fetch-depth: 0
2730

28-
- uses: jdx/mise-action@d6e32c1796099e0f1f3ac741c220a8b7eae9e5dd
31+
- name: 02-setup-tooling
32+
uses: jdx/mise-action@d6e32c1796099e0f1f3ac741c220a8b7eae9e5dd
2933
with:
3034
install: true
3135
cache: true
3236
experimental: true
3337
env:
3438
# Required for aqua-backed tool installs to avoid GitHub API rate limits in CI.
35-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
GITHUB_TOKEN: ${{ github.token }}
3640

37-
- name: Setup
41+
- name: 03-setup
3842
run: mise run setup
3943

40-
- name: Test
44+
- name: 04-test
4145
run: mise run test
4246

43-
- id: inputs
44-
uses: simenandre/setup-inputs@v1
45-
46-
- name: Publish to npm with OIDC
47+
- name: 05-publish-to-npm-with-oidc
4748
run: |
48-
TAG="${{ steps.inputs.outputs.tag }}"
49-
if [ -z "$TAG" ]; then
50-
TAG="latest"
51-
fi
49+
TAG="${{ github.event.inputs.tag || github.event.client_payload.tag || 'latest' }}"
5250
5351
echo "Publishing with tag: $TAG"
5452
mise run publish --tag "$TAG"
5553
56-
- name: Verify published version
54+
- name: 06-verify-published-version
5755
run: |
5856
set -euo pipefail
5957
60-
TAG="${{ steps.inputs.outputs.tag }}"
61-
if [ -z "$TAG" ]; then
62-
TAG="latest"
63-
fi
58+
TAG="${{ github.event.inputs.tag || github.event.client_payload.tag || 'latest' }}"
6459
6560
NAME="$(node -p 'require("./package.json").name')"
6661
VERSION="$(node -p 'require("./package.json").version')"

.github/workflows/refresh-docs-snapshot.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Refresh Docs Snapshot
1+
name: 05-refresh-docs-snapshot
22

33
on:
44
workflow_dispatch:
@@ -9,28 +9,29 @@ permissions:
99

1010
jobs:
1111
refresh:
12+
name: 01-refresh-docs-snapshot
1213
runs-on: ubuntu-latest
1314
steps:
14-
- name: Checkout
15+
- name: 01-checkout
1516
uses: actions/checkout@v4
1617

17-
- name: Setup Tooling
18+
- name: 02-setup-tooling
1819
uses: jdx/mise-action@d6e32c1796099e0f1f3ac741c220a8b7eae9e5dd
1920
with:
2021
install: true
2122
cache: true
2223
experimental: true
2324
env:
2425
# Required for aqua-backed tool installs to avoid GitHub API rate limits in CI.
25-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
GITHUB_TOKEN: ${{ github.token }}
2627

27-
- name: Refresh docs parquet
28+
- name: 03-refresh-docs-parquet
2829
run: |
2930
mise run setup
3031
mkdir -p .memory
3132
DOCS_SUMMARY_PATH=.memory/docs-refresh-summary.json bun run src/docs/fetch-cli.ts
3233
33-
- name: Build PR body
34+
- name: 04-build-pr-body
3435
run: |
3536
node <<'NODE'
3637
const fs = require('fs');
@@ -56,7 +57,7 @@ jobs:
5657
fs.writeFileSync('.memory/docs-refresh-pr-body.md', `${body}\n`, 'utf8');
5758
NODE
5859
59-
- name: Create pull request
60+
- name: 05-create-pull-request
6061
uses: peter-evans/create-pull-request@v7
6162
with:
6263
branch: chore/refresh-docs-snapshot

.github/workflows/release.yml

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Release
1+
name: 06-release
22

33
on:
44
push:
@@ -9,17 +9,21 @@ concurrency:
99
group: ${{ github.workflow }}-${{ github.ref }}
1010

1111
permissions:
12-
contents: write
13-
pull-requests: write
12+
contents: read
1413

1514
jobs:
1615
process:
16+
name: 01-release-please
1717
runs-on: ubuntu-latest
18+
permissions:
19+
contents: write
20+
pull-requests: write
1821
outputs:
1922
releases_created: ${{ steps.release-please.outputs.releases_created }}
2023
prs_created: ${{ steps.release-please.outputs.prs_created }}
2124
steps:
22-
- uses: googleapis/release-please-action@v4
25+
- name: 01-release-please
26+
uses: googleapis/release-please-action@v4
2327
id: release-please
2428
with:
2529
token: ${{ secrets.RELEASE_PLEASE_TOKEN || github.token }}
@@ -28,22 +32,33 @@ jobs:
2832
skip-github-pull-request: false
2933

3034
dispatch-publish:
35+
name: 02-dispatch-publish
3136
needs: process
3237
runs-on: ubuntu-latest
38+
permissions:
39+
contents: write
3340
if: needs.process.outputs.releases_created == 'true' || needs.process.outputs.prs_created == 'true'
3441
steps:
35-
- name: Dispatch publish for releases
42+
- name: 01-dispatch-latest-publish
3643
if: needs.process.outputs.releases_created == 'true'
37-
uses: peter-evans/repository-dispatch@v2
44+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
3845
with:
39-
token: ${{ secrets.GITHUB_TOKEN }}
40-
event-type: publish-package
41-
client-payload: '{"tag": "latest"}'
46+
script: |
47+
await github.rest.repos.createDispatchEvent({
48+
owner: context.repo.owner,
49+
repo: context.repo.repo,
50+
event_type: 'publish-package',
51+
client_payload: { tag: 'latest' },
52+
});
4253
43-
- name: Dispatch publish for prerelease
54+
- name: 02-dispatch-next-publish
4455
if: needs.process.outputs.prs_created == 'true'
45-
uses: peter-evans/repository-dispatch@v2
56+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
4657
with:
47-
token: ${{ secrets.GITHUB_TOKEN }}
48-
event-type: publish-package
49-
client-payload: '{"tag": "next"}'
58+
script: |
59+
await github.rest.repos.createDispatchEvent({
60+
owner: context.repo.owner,
61+
repo: context.repo.repo,
62+
event_type: 'publish-package',
63+
client_payload: { tag: 'next' },
64+
});

0 commit comments

Comments
 (0)