Skip to content

Commit 4471139

Browse files
authored
use gh actions cache
1 parent ff51477 commit 4471139

File tree

6 files changed

+531
-57
lines changed

6 files changed

+531
-57
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55

66
jobs:
77
build:
8-
name: Build, Document, and Deploy
8+
name: Build and Document Userscripts
99
runs-on: ubuntu-latest
1010
steps:
1111
- name: Checkout Repository
@@ -15,6 +15,10 @@ jobs:
1515
uses: actions/setup-node@v5
1616
with:
1717
node-version: "lts/*"
18+
cache: "npm"
19+
20+
- name: Install Dependencies
21+
run: npm ci
1822

1923
- name: Generate All Files
2024
run: bash build.sh ${{ github.repository }}

.github/workflows/delete-old-workflow-runs.yml renamed to .github/workflows/delete-workflow-runs.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
1-
name: Delete Old Workflow Runs
1+
name: Delete Workflow Runs
22

33
on:
44
workflow_dispatch:
55
inputs:
66
retain_days:
77
description: 'Days-worth of runs to keep for each workflow'
8-
required: true
9-
default: '2'
8+
default: '30'
109
keep_minimum_runs:
1110
description: 'Minimum runs to keep for each workflow'
12-
required: true
13-
default: '5'
14-
schedule:
15-
- cron: '0 2 * * 0'
11+
default: '6'
1612

1713
jobs:
1814
build:
19-
name: Delete Old Workflow Runs
15+
name: Delete Workflow Runs
2016
runs-on: ubuntu-latest
2117
steps:
22-
- name: Delete Old Workflow Runs
18+
- name: Delete Workflow Runs
2319
uses: Mattraks/delete-workflow-runs@v2
2420
with:
2521
retain_days: ${{ github.event.inputs.retain_days }}

.github/workflows/squash-commits.yml

Lines changed: 0 additions & 38 deletions
This file was deleted.

build.sh

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
set -e
33

4-
# --- CONFIGURATION ---
4+
# --- CONFIG ---
55
REPO_SLUG=$1
66
if [[ -z "$REPO_SLUG" ]]; then
77
printf 'Error: Repository slug not provided. Exiting.\n' >&2; exit 1
@@ -15,16 +15,12 @@ DIST_DIR='userscripts/dist'
1515
DOCS_DIR='userscripts/docs'
1616
SCREENSHOTS_DIR='userscripts/docs/screenshots'
1717

18-
# --- SETUP ---
19-
printf 'Initializing build environment...\n'
20-
npm install --save-dev esbuild cloc > /dev/null
21-
18+
# --- PREP ---
2219
printf 'Removing old build artifacts...\n'
2320
mkdir -p "$META_DIR" "$DIST_DIR" "$DOCS_DIR" "$SCREENSHOTS_DIR"
2421
find "$META_DIR" "$DIST_DIR" "$DOCS_DIR" -maxdepth 1 -type f -delete
2522

26-
# --- README PREPARATION ---
27-
printf 'Preparing README.md for update...\n'
23+
printf 'Creating temp files for README.md update...\n'
2824
BEFORE_TABLE_FILE=$(mktemp)
2925
AFTER_TABLE_FILE=$(mktemp)
3026
TABLE_CONTENT_FILE=$(mktemp)
@@ -60,7 +56,7 @@ for file in "$SRC_DIR"/*.user.js; do
6056
printf 'Error: Userscript ID from filename does not match ID from namespace. Exiting.\n' >&2; exit 1
6157
fi
6258

63-
# --- 3. GENERATE DIST AND META VERSIONS ---
59+
# --- 3. GENERATE DIST AND META FILES ---
6460
header="$(sed \
6561
${readme_comment:+-e '\|// @description| s|$| See README for details.|'} \
6662
-e '\|// @namespace|d' \
@@ -128,7 +124,7 @@ userscript_count=$(find "$SRC_DIR" -name "*.user.js" | wc -l)
128124
) > README.md
129125

130126
# --- CLEANUP ---
131-
printf 'Cleaning up temporary files...\n'
127+
printf 'Removing temp files...\n'
132128
rm -f "$BEFORE_TABLE_FILE" "$AFTER_TABLE_FILE" "$TABLE_CONTENT_FILE"
133129

134130
printf 'Build process completed successfully!\n'

0 commit comments

Comments
 (0)