Skip to content

Commit d584b99

Browse files
chore: align github workflows with javascript repository
- Rename ci.yml to cicd.yml - Add concurrency and PR triggers for all branches - Upgrade actions/checkout and actions/setup-node to v5 - Add pnpm cache for faster CI - Add codeql-analysis.yml for security scanning - Add stale.yml to close inactive PRs Amp-Thread-ID: https://ampcode.com/threads/T-019b9ec0-22e7-7184-825d-0c818d40fb94 Co-authored-by: Amp <amp@ampcode.com>
1 parent b8174f0 commit d584b99

File tree

4 files changed

+103
-13
lines changed

4 files changed

+103
-13
lines changed
Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1-
name: CI
2-
3-
on:
1+
name: CICD
2+
on:
43
push:
5-
branches: [main]
4+
branches:
5+
- 'main'
66
pull_request:
7-
branches: [main]
7+
branches:
8+
- '*'
89

910
jobs:
10-
test:
11+
cicd:
1112
runs-on: ubuntu-latest
12-
13+
concurrency: ${{ github.workflow }}-${{ github.ref }}
1314
steps:
1415
- name: Checkout code
15-
uses: actions/checkout@v4
16+
uses: actions/checkout@v5
1617

1718
- name: Setup pnpm
1819
uses: pnpm/action-setup@v4
@@ -21,9 +22,10 @@ jobs:
2122
run: sudo apt-get update && sudo apt-get install -y libsecret-1-dev build-essential python3
2223

2324
- name: Setup Node.js
24-
uses: actions/setup-node@v4
25+
uses: actions/setup-node@v5
2526
with:
26-
node-version-file: ".nvmrc"
27+
node-version-file: '.nvmrc'
28+
cache: 'pnpm'
2729

2830
- name: Install dependencies
2931
run: pnpm install
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ main ]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [ main ]
20+
schedule:
21+
- cron: '19 21 * * 3'
22+
23+
jobs:
24+
analyze:
25+
name: Analyze
26+
runs-on: ubuntu-latest
27+
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
language: [ 'javascript' ]
32+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
33+
# Learn more:
34+
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
35+
36+
steps:
37+
- name: Checkout repository
38+
uses: actions/checkout@v5
39+
40+
# Initializes the CodeQL tools for scanning.
41+
- name: Initialize CodeQL
42+
uses: github/codeql-action/init@v4
43+
with:
44+
languages: ${{ matrix.language }}
45+
# If you wish to specify custom queries, you can do so here or in a config file.
46+
# By default, queries listed here will override any specified in a config file.
47+
# Prefix the list here with "+" to use these queries and those in the config file.
48+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
49+
50+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
51+
# If this step fails, then you should remove it and run the build manually (see below)
52+
- name: Autobuild
53+
uses: github/codeql-action/autobuild@v4
54+
55+
# ℹ️ Command-line programs to run using the OS shell.
56+
# 📚 https://git.io/JvXDl
57+
58+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
59+
# and modify them (or add more) to build your code if your project
60+
# uses a compiled language
61+
62+
#- run: |
63+
# make bootstrap
64+
# make release
65+
66+
- name: Perform CodeQL Analysis
67+
uses: github/codeql-action/analyze@v4

.github/workflows/release.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- name: Checkout Repo
16-
uses: actions/checkout@v4
16+
uses: actions/checkout@v5
1717

1818
- name: Setup pnpm
1919
uses: pnpm/action-setup@v4
@@ -22,12 +22,13 @@ jobs:
2222
run: sudo apt-get update && sudo apt-get install -y libsecret-1-dev build-essential python3
2323

2424
- name: Setup Node
25-
uses: actions/setup-node@v4
25+
uses: actions/setup-node@v5
2626
with:
2727
node-version-file: ".nvmrc"
28+
cache: "pnpm"
2829

2930
- name: Install Dependencies
30-
run: pnpm install
31+
run: pnpm install --prefer-offline
3132

3233
- name: Build
3334
run: pnpm run build

.github/workflows/stale.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Close Stale PRs
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: '30 1 * * *'
7+
jobs:
8+
stale:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Close Stale Issues
12+
uses: actions/stale@v10
13+
with:
14+
repo-token: ${{ secrets.GITHUB_TOKEN }}
15+
stale-pr-message: |
16+
'This PR is stale as it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.'
17+
close-pr-message: |
18+
'This PR was closed because it has been stalled for 5 days with no activity.'
19+
days-before-pr-stale: 30
20+
days-before-pr-close: 5

0 commit comments

Comments
 (0)