mirror of
https://github.com/ivuorinen/tree-sitter-shellspec.git
synced 2026-02-03 02:47:12 +00:00
chore: lint and code review fixes
This commit is contained in:
61
.github/workflows/release.yml
vendored
61
.github/workflows/release.yml
vendored
@@ -1,5 +1,5 @@
|
||||
---
|
||||
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
|
||||
# yaml-language-server: $schema=https://www.schemastore.org/github-workflow.json
|
||||
name: Release
|
||||
|
||||
on:
|
||||
@@ -67,20 +67,36 @@ jobs:
|
||||
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
|
||||
with:
|
||||
script: |
|
||||
// Find CI workflow by name or filename
|
||||
const { data: allWorkflows } = await github.rest.actions.listRepoWorkflows({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo
|
||||
});
|
||||
|
||||
const ciWorkflow = allWorkflows.workflows.find(w =>
|
||||
w.name === 'CI' ||
|
||||
w.path === '.github/workflows/test.yml'
|
||||
);
|
||||
|
||||
if (!ciWorkflow) {
|
||||
core.setFailed('Could not find CI workflow');
|
||||
return;
|
||||
}
|
||||
|
||||
const { data: workflows } = await github.rest.actions.listWorkflowRuns({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
workflow_id: 'test.yml',
|
||||
workflow_id: ciWorkflow.id,
|
||||
head_sha: context.sha,
|
||||
status: 'completed'
|
||||
});
|
||||
|
||||
const latestRun = workflows.workflow_runs[0];
|
||||
if (!latestRun || latestRun.conclusion !== 'success') {
|
||||
core.setFailed('CI workflow has not passed for this commit');
|
||||
core.setFailed(`CI workflow has not passed for this commit. Status: ${latestRun?.conclusion || 'not found'}`);
|
||||
}
|
||||
|
||||
console.log(`CI status: ${latestRun?.conclusion || 'not found'}`)
|
||||
console.log(`CI workflow ID: ${ciWorkflow.id}, Status: ${latestRun?.conclusion || 'not found'}`)
|
||||
|
||||
security:
|
||||
name: 🔒 Security Scan
|
||||
@@ -96,7 +112,15 @@ jobs:
|
||||
uses: actions/setup-node@7c12f8017d5436eb855f1ed4399f037a36fbd9e8 # v5.2.1
|
||||
with:
|
||||
node-version: 24
|
||||
cache: npm
|
||||
|
||||
- name: Cache Node.js dependencies
|
||||
uses: actions/cache@dfa6ed13c88fe79b56c4ffc79a42db2e8d2b15a5 # v4.2.0
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-node-24-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node-24-
|
||||
${{ runner.os }}-node-
|
||||
|
||||
- name: Install Dependencies
|
||||
run: npm ci || { echo "❌ npm install failed"; npm install; }
|
||||
@@ -126,16 +150,41 @@ jobs:
|
||||
uses: actions/setup-node@7c12f8017d5436eb855f1ed4399f037a36fbd9e8 # v5.2.1
|
||||
with:
|
||||
node-version: 24
|
||||
cache: npm
|
||||
registry-url: "https://registry.npmjs.org"
|
||||
|
||||
- name: Cache Node.js dependencies
|
||||
uses: actions/cache@dfa6ed13c88fe79b56c4ffc79a42db2e8d2b15a5 # v4.2.0
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-node-24-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node-24-
|
||||
${{ runner.os }}-node-
|
||||
|
||||
- name: Install Dependencies
|
||||
run: npm ci || { echo "❌ npm install failed"; npm install; }
|
||||
|
||||
- name: Cache Tree-sitter CLI
|
||||
uses: actions/cache@dfa6ed13c88fe79b56c4ffc79a42db2e8d2b15a5 # v4.2.0
|
||||
with:
|
||||
path: ~/.npm/_npx
|
||||
key: ${{ runner.os }}-tree-sitter-cli-${{ hashFiles('package.json') }}
|
||||
|
||||
- name: Install Tree-sitter CLI
|
||||
run: npm install -g tree-sitter-cli
|
||||
|
||||
- name: Cache Generated Grammar
|
||||
uses: actions/cache@dfa6ed13c88fe79b56c4ffc79a42db2e8d2b15a5 # v4.2.0
|
||||
id: cache-grammar
|
||||
with:
|
||||
path: |
|
||||
src/parser.c
|
||||
src/tree_sitter/
|
||||
binding.gyp
|
||||
key: ${{ runner.os }}-grammar-${{ hashFiles('grammar.js', 'package.json') }}
|
||||
|
||||
- name: Generate Grammar
|
||||
if: steps.cache-grammar.outputs.cache-hit != 'true'
|
||||
run: npm run generate
|
||||
|
||||
- name: 🏗️ Build Parser
|
||||
|
||||
Reference in New Issue
Block a user