Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @tetherto/miningos-bk-merge
20 changes: 20 additions & 0 deletions .github/actions/git-secrets/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: 'Git Secrets Scan'
description: 'Scan repository for secrets using git-secrets'

runs:
using: "composite"
steps:
- name: Install and configure git-secrets
shell: bash
run: |
git clone https://github.com/awslabs/git-secrets.git
cd git-secrets
git checkout 1.3.0
sudo make install
cd ..
git secrets --install
git secrets --register-aws

- name: Run git-secrets scan
shell: bash
run: git secrets --scan-history
36 changes: 36 additions & 0 deletions .github/actions/node-restore-cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: 'Node Restore Cache'
description: 'Restore Node.js dependencies from cache'

inputs:
cache-key:
description: 'Cache key from setup-node step'
required: true

runs:
using: composite
steps:
# Restore-only: avoids "another job may be creating this cache" when setup and downstream jobs race on save
- name: Restore node modules cache
id: cache-node-modules
uses: actions/cache/restore@v4
with:
path: node_modules
key: ${{ inputs.cache-key }}
restore-keys: |
node-modules-${{ runner.os }}-20.x-

- name: Setup Node.js
if: steps.cache-node-modules.outputs.cache-hit != 'true'
uses: actions/setup-node@v6
with:
node-version: '20.x'

- name: Install Dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
shell: bash
run: |
if [ -f package-lock.json ]; then
npm ci
else
npm install
fi
73 changes: 73 additions & 0 deletions .github/actions/node-setup-cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: 'Node.js Setup with Cache'
description: 'Sets up Node.js with dependency caching for the initial setup job'
author: 'miningos-devops'

inputs:
node-version:
description: 'Node.js version to use'
required: false
default: '20.x'
install-dependencies:
description: 'Whether to install dependencies on cache miss'
required: false
default: 'true'
additional-packages:
description: 'Additional system packages to install (space-separated)'
required: false
default: ''

outputs:
cache-key:
description: 'The generated cache key for node_modules'
value: ${{ steps.cache-keys.outputs.cache-key }}
cache-hit:
description: 'Whether the cache was hit'
value: ${{ steps.cache-node-modules.outputs.cache-hit }}

runs:
using: composite
steps:
- name: Generate cache keys
id: cache-keys
shell: bash
run: |
NODE_VERSION="${{ inputs.node-version }}"
BASE_KEY="node-modules-${{ runner.os }}-${NODE_VERSION}"
# Stable key per deps so downstream jobs and future runs get cache hits
HASH_KEY="${BASE_KEY}-${{ hashFiles('package-lock.json', 'package.json') }}"
echo "cache-key=${HASH_KEY}" >> $GITHUB_OUTPUT
echo "base-key=${BASE_KEY}" >> $GITHUB_OUTPUT

- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: ${{ inputs.node-version }}

- name: Install additional system packages
if: inputs.additional-packages != ''
shell: bash
run: |
echo "Installing additional packages: ${{ inputs.additional-packages }}"
sudo apt update
sudo apt install -y ${{ inputs.additional-packages }}

- name: Install dependencies
if: inputs.install-dependencies == 'true'
shell: bash
run: |
if [ -f package-lock.json ]; then
echo "Found package-lock.json, using npm ci for deterministic installs"
npm ci
else
echo "No package-lock.json found, using npm install"
npm install
fi

- name: Cache node modules
id: cache-node-modules
uses: actions/cache@v4
with:
path: node_modules
key: ${{ steps.cache-keys.outputs.cache-key }}
restore-keys: |
${{ steps.cache-keys.outputs.base-key }}-
Loading
Loading