Skip to content

Commit a4e10f8

Browse files
authored
Reorganize GitHub Workflows to enable running on PRs (#906)
1 parent d90302e commit a4e10f8

6 files changed

Lines changed: 146 additions & 117 deletions

File tree

.github/workflows/code-scan-update-mirror.yml

Lines changed: 0 additions & 114 deletions
This file was deleted.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Code Scanning
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
branches:
8+
- main
9+
10+
jobs:
11+
njsscan:
12+
name: njsscan
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout the code
16+
uses: actions/checkout@v6
17+
- name: nodejsscan scan
18+
id: njsscan
19+
uses: ajinabraham/njsscan-action@master
20+
with:
21+
args: ". --sarif --output results.sarif || true"
22+
- name: Upload njsscan report
23+
uses: github/codeql-action/upload-sarif@v4
24+
with:
25+
sarif_file: results.sarif
26+
codeql:
27+
needs: njsscan
28+
name: CodeQL
29+
runs-on: ubuntu-latest
30+
strategy:
31+
fail-fast: false
32+
matrix:
33+
language: ["javascript"]
34+
steps:
35+
- name: Checkout repository
36+
uses: actions/checkout@v6
37+
- name: Set up Nodejs
38+
uses: actions/setup-node@v6
39+
with:
40+
node-version: 26
41+
cache: "npm"
42+
- name: Initialize CodeQL
43+
uses: github/codeql-action/init@v4
44+
with:
45+
languages: ${{ matrix.language }}
46+
- name: Autobuild
47+
uses: github/codeql-action/autobuild@v4
48+
- name: Perform CodeQL Analysis
49+
uses: github/codeql-action/analyze@v4
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Mirror to opencode.net and update Flathub commit id
2+
on:
3+
workflow_run:
4+
workflows:
5+
- "Execute tests"
6+
types:
7+
- completed
8+
branches:
9+
- main
10+
11+
jobs:
12+
mirror:
13+
name: Mirror code to opencode.net
14+
runs-on: ubuntu-latest
15+
if: github.event.workflow_run.conclusion == 'success'
16+
steps:
17+
- uses: actions/checkout@v6
18+
with:
19+
ref: ${{ github.event.workflow_run.head_sha }}
20+
fetch-depth: 0
21+
fetch-tags: true
22+
- name: Push to GitLab mirror
23+
run: |
24+
git push --force \
25+
"https://ransome:${{ secrets.GITLAB_PAT }}@www.opencode.net/ransome/sleek.git" \
26+
"HEAD:refs/heads/main" \
27+
"refs/tags/*:refs/tags/*"
28+
flathub:
29+
name: Update commit id in Flathub repo
30+
runs-on: ubuntu-latest
31+
needs: mirror
32+
steps:
33+
- name: Trigger Flathub build
34+
uses: peter-evans/repository-dispatch@v4
35+
with:
36+
token: ${{ secrets.TRIGGER_FLATHUB_BUILD }}
37+
repository: ransome1/com.github.ransome1.sleek
38+
event-type: trigger-flathub-build
39+
client-payload: '{"commit_id": "${{ github.event.workflow_run.head_sha }}"}'

.github/workflows/prepare-release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Install Node and NPM
1717
uses: actions/setup-node@v6
1818
with:
19-
node-version: 25
19+
node-version: 26
2020
cache: "npm"
2121
- name: Install and build
2222
run: |
@@ -47,7 +47,7 @@ jobs:
4747
- name: Install Node and NPM
4848
uses: actions/setup-node@v6
4949
with:
50-
node-version: 25
50+
node-version: 26
5151
cache: "npm"
5252
- name: Install and build
5353
run: |
@@ -73,7 +73,7 @@ jobs:
7373
- name: Install Node and NPM
7474
uses: actions/setup-node@v6
7575
with:
76-
node-version: 25
76+
node-version: 26
7777
cache: "npm"
7878
- name: Install and build
7979
run: |

.github/workflows/snyk.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Snyk Dependency Scanning
2+
on: push
3+
4+
jobs:
5+
snyk:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v6
9+
- name: Run Snyk to check for vulnerabilities
10+
uses: snyk/actions/node@master
11+
env:
12+
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
13+
with:
14+
args: --sarif-file-output=snyk.sarif
15+
- name: Upload result to GitHub Code Scanning
16+
uses: github/codeql-action/upload-sarif@v3
17+
with:
18+
sarif_file: snyk.sarif

.github/workflows/tests.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Execute tests
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
branches:
8+
- main
9+
10+
jobs:
11+
test:
12+
name: Run tests and formatting
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v6
17+
- name: Set up Nodejs
18+
uses: actions/setup-node@v6
19+
with:
20+
node-version: 26
21+
cache: "npm"
22+
- name: Install dependencies
23+
run: npm install
24+
- name: Build
25+
run: npm run build
26+
- name: Check formatting
27+
run: npm run format
28+
- name: Lint with ESLint
29+
run: npm run lint
30+
- name: Check TypeScript typings
31+
run: npm run typecheck
32+
- name: Run unit tests
33+
run: npm run coverage
34+
- name: Upload coverage reports to Codecov
35+
uses: codecov/codecov-action@v7
36+
env:
37+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)