feat: automate dist recompilation on Renovate PRs and configure concurrency limit #120

Merged
Philipp merged 5 commits from feature/renovate-recompile-dist into main 2026-09-04 23:20:17 +02:00
7 changed files with 130 additions and 76 deletions
+55
View File
@@ -0,0 +1,55 @@
name: Recompile dist/ on Renovate PR
on:
pull_request:
types: [opened, synchronize]
paths:
- package.json
- pnpm-lock.yaml
- index.js
- monitor.js
permissions:
contents: write
jobs:
recompile:
runs-on: pi
if: |
(github.actor == 'renovate[bot]' || contains(github.head_ref, 'renovate/')) &&
!contains(github.event.head_commit.message, '[skip compile]')
steps:
- name: Checkout PR Branch
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ github.head_ref }}
fetch-depth: 0
- uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: '22'
cache: pnpm
- name: Clean Install
run: pnpm install --frozen-lockfile --ignore-scripts
shell: bash
- name: Build
run: pnpm run build
shell: bash
- name: Commit dist/
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add dist/
Philipp marked this conversation as resolved
Review

The use of [skip compile] in the commit message is a good way to prevent circular workflow triggers. Ensure this is consistent if you add other workflows that commit back to the repo.

The use of `[skip compile]` in the commit message is a good way to prevent circular workflow triggers. Ensure this is consistent if you add other workflows that commit back to the repo.
if git diff --staged --quiet; then
echo "No changes to dist/"
else
git commit -m "chore: compile action bundle [skip compile]"
git push origin HEAD:${{ github.head_ref }}
fi
shell: bash
+3 -1
View File
@@ -2,6 +2,7 @@ name: Test
on:
push:
pull_request:
workflow_dispatch:
jobs:
@@ -10,10 +11,11 @@ jobs:
runs-on: pi
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: '24'
- uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10
cache: pnpm
- run: pnpm install --frozen-lockfile
shell: bash
- run: pnpm test
+6
View File
@@ -7,6 +7,7 @@ This repository is maintained by Gemini.
* **Test-Driven Development (TDD):** Wherever possible, Test-Driven Development principles should be followed. Write tests before writing the code they are intended to validate.
* **Pre-commit Hooks:** Ensure that `pre-commit` hooks are installed and active before making any commits. This can be done by running `pre-commit install` in your local repository.
* **Note for Gemini:** Git commits trigger pre-commit hooks, which can take several seconds (or minutes) to complete. Checking the command status for git commit is only appropriate every 120s.
* **Package Manager Preferences:** Always use `pnpm` and `pnpx`. Never use `npm` or `npx` under any circumstances. All package management operations, script runs, and tool invocations must use `pnpm` / `pnpx`.
## Repository Comparison
@@ -32,3 +33,8 @@ The Gitea workflow does the following:
2. Sets up Node.js and pnpm.
3. Installs the dependencies using `pnpm install`.
4. Runs the tests using `pnpm test`.
### Automated Recompilation & Permissions
* The automated recompilation workflow (`.gitea/workflows/recompile-dist.yaml`) recompiles `dist/index.js` on Renovate PRs and requires `contents: write` permissions to push back to the branch.
* Ensure that the Gitea repository workflow settings have write permissions enabled (**Settings** ➔ **Actions****General****Workflow permissions****Read and write permissions**).
+1 -1
View File
@@ -1,4 +1,4 @@
import { vi, describe, it, expect, beforeEach } from "vitest";
import { vi, describe, it, expect, beforeEach, afterEach } from "vitest";
// Mock @actions/core for all tests in this file
vi.mock("@actions/core", () => ({
+3 -3
View File
@@ -3,7 +3,7 @@
"version": "0.2.1",
"description": "Deploys screeps code to the official game or a private server.",
"type": "module",
"packageManager": "pnpm@11.21.0",
"packageManager": "pnpm@11.25.0",
"main": "index.js",
"scripts": {
"start": "node index.js",
@@ -18,7 +18,7 @@
},
"devDependencies": {
"@vercel/ncc": "^0.44.1",
"@vitest/coverage-v8": "^4.1.10",
"vitest": "^4.1.10"
"@vitest/coverage-v8": "^4.1.11",
"vitest": "^4.1.11"
}
}
+56 -56
View File
@@ -25,11 +25,11 @@ importers:
specifier: ^0.44.1
version: 0.44.1
'@vitest/coverage-v8':
specifier: ^4.1.10
version: 4.1.10(vitest@4.1.10)
specifier: ^4.1.11
version: 4.1.11(vitest@4.1.11)
vitest:
specifier: ^4.1.10
version: 4.1.10(@vitest/coverage-v8@4.1.10)(vite@8.2.1(yaml@2.9.0))
specifier: ^4.1.11
version: 4.1.11(@vitest/coverage-v8@4.1.11)(vite@8.2.1(yaml@2.9.0))
packages:
@@ -207,20 +207,20 @@ packages:
resolution: {integrity: sha512-cUjIE5P2YY1n+Kt9rFIazMMpGoPn1Fic04rOmTkElMkiDP5oszGfERMpo2shVkFKDL7rVppdM2pqJKC59shQWQ==}
hasBin: true
'@vitest/coverage-v8@4.1.10':
resolution: {integrity: sha512-IM49HmthevbgAO4anp1hwtoT9wYe59w0LR00gr+eagHE+ZJ5lK4sLPeO0ubgoJcwLk6dehU3R24N+FbEEKDc8g==}
'@vitest/coverage-v8@4.1.11':
resolution: {integrity: sha512-8MVGEFnJIcdGjcbfKmeq8z0pZHH0JlVtoVZH9Q/qwUp6wyFnEJUBMrw9DCaj+ra3vShGmhavjalMIhPNxZAUcw==}
peerDependencies:
'@vitest/browser': 4.1.10
vitest: 4.1.10
'@vitest/browser': 4.1.11
vitest: 4.1.11
peerDependenciesMeta:
'@vitest/browser':
optional: true
'@vitest/expect@4.1.10':
resolution: {integrity: sha512-YsCn+qAk1GWjQOWFEsEcL2gNQ0zmVmQu3T03qP6UyjhtmdtwtbuI+DASn/7iQB3HGTXkdBwGddzxPlmiql5vlA==}
'@vitest/expect@4.1.11':
resolution: {integrity: sha512-VX2x5vNJXET47KAFzwERI+KRMtTTCSWTfSMKsW7JsUsXV4psq++e3DvZpuTDOpHcxytiDs6p2nhVb2tVDiiUYw==}
'@vitest/mocker@4.1.10':
resolution: {integrity: sha512-v0xaezt+DKEmKfaxg133ldzADrwLGd7Ze1MfQQTYfvs8OqZIwbxyxaYURivwV7sWy5fqn3rH5uOrSp07bp44Ow==}
'@vitest/mocker@4.1.11':
resolution: {integrity: sha512-2XJVD55d1o5AZous5CCGKS74g/riOj9odEt2bQpCVZeblHyHdnMeFl4jl0XjU21stf4mbjUkew2eXQZt65g5CQ==}
peerDependencies:
msw: ^2.4.9
vite: ^6.0.0 || ^7.0.0 || ^8.0.0
@@ -230,20 +230,20 @@ packages:
vite:
optional: true
'@vitest/pretty-format@4.1.10':
resolution: {integrity: sha512-W1HsjSH4MXQ9YfmmhLAoIYf1HRfekQCGngeIgcei6MP5QQGWUe0gkopdZQaVCFO+JDJMrAJGwa5pRpNpvy4P8Q==}
'@vitest/pretty-format@4.1.11':
resolution: {integrity: sha512-yiZzPbGTS9Sr/JpFl8zHrcIkAofNbFV6k21vIgQN/cY/oxZeXhJv5sc/MBJ5jFKWmWs+oJHw0UXLZjmf931+Vw==}
'@vitest/runner@4.1.10':
resolution: {integrity: sha512-IKI6kpIH+LmpROplyLwBBaCfMgOZOMsygVa6BARD6ahA04VRuJSa6OaVG7kRvSEMD870Vd91rSSw0eegtWyLGg==}
'@vitest/runner@4.1.11':
resolution: {integrity: sha512-LztvUgdwMNJMIkj3hQnnxiC2Xy1zNxq928W/xhjCLaNCzqTZOudjwbQf6v9IntZGPw132i2Lq2rgTRZHD3JHNw==}
'@vitest/snapshot@4.1.10':
resolution: {integrity: sha512-xRkfOT1qpTAi/Ti4Y1LtfRc3kEuqxGw59eN2jN9pRWMtS/XDevekhcFSqvQqjUNGksfjMJu3Y+oJ+4Ypn2OaJw==}
'@vitest/snapshot@4.1.11':
resolution: {integrity: sha512-pN7ikn1ON7h8ee4gIAp4AzyK+zBtJPzVbqOgu5LCEh4VaJVbPQcgYQYJIMGQPXVeJJq1fnfazis7a5pFNPahog==}
'@vitest/spy@4.1.10':
resolution: {integrity: sha512-PLf/Ugvoq5wO/b4rwYCR1h2PSIdXz7wnkQFMiUpLdtM7l6pqVFcQIBEHyT1+l+cj7mNwAfZHzqXqDyjvOuwbDw==}
'@vitest/spy@4.1.11':
resolution: {integrity: sha512-apNa/prQy2qCeywhnixOHPRCgGNhvg7T4Dapfl1GahLp/R+uhBm5cPyFoNVyqsNd2h1nJxL6BqqdIjiABL60YA==}
'@vitest/utils@4.1.10':
resolution: {integrity: sha512-fy9am/HWxbaGt/Sawrp90vt6Y6jQwf1RX77cz3uwoJwJVMli/e1IEwRPnMNJ7vKfPTwo0diXifkpPvwH9v7nGA==}
'@vitest/utils@4.1.11':
resolution: {integrity: sha512-zTCVGpyFsGWBhllOyKlTw/vnr6D9qxsfSDyfbyZmTyjHw5N/VuvzHpHoQjm2ZJzn4RJgx5w4r7V0er69CmLgPQ==}
argparse@1.0.10:
resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==}
@@ -712,20 +712,20 @@ packages:
yaml:
optional: true
vitest@4.1.10:
resolution: {integrity: sha512-R9jUTe5S4Qb0HCd4TNqpC7oGcrMssMRGXLW80ubjWsW9VH5GF8y1Y0SFLY9AbqSk6nt0PnOx4H4WNJYZ13GUPw==}
vitest@4.1.11:
resolution: {integrity: sha512-fhACrNXUidIbGSBr5FlbuBkO7VWC1ZyLl0DO4CU2DrQoAPxX84Ysxs+HeGQpii5lZWV1Q4gBZTTu49mF+A6Edw==}
engines: {node: ^20.0.0 || ^22.0.0 || >=24.0.0}
hasBin: true
peerDependencies:
'@edge-runtime/vm': '*'
'@opentelemetry/api': ^1.9.0
'@types/node': ^20.0.0 || ^22.0.0 || >=24.0.0
'@vitest/browser-playwright': 4.1.10
'@vitest/browser-preview': 4.1.10
'@vitest/browser-webdriverio': 4.1.10
'@vitest/coverage-istanbul': 4.1.10
'@vitest/coverage-v8': 4.1.10
'@vitest/ui': 4.1.10
'@vitest/browser-playwright': 4.1.11
'@vitest/browser-preview': 4.1.11
'@vitest/browser-webdriverio': 4.1.11
'@vitest/coverage-istanbul': 4.1.11
'@vitest/coverage-v8': 4.1.11
'@vitest/ui': 4.1.11
happy-dom: '*'
jsdom: '*'
vite: ^6.0.0 || ^7.0.0 || ^8.0.0
@@ -908,10 +908,10 @@ snapshots:
'@vercel/ncc@0.44.1': {}
'@vitest/coverage-v8@4.1.10(vitest@4.1.10)':
'@vitest/coverage-v8@4.1.11(vitest@4.1.11)':
dependencies:
'@bcoe/v8-coverage': 1.0.2
'@vitest/utils': 4.1.10
'@vitest/utils': 4.1.11
ast-v8-to-istanbul: 1.0.5
istanbul-lib-coverage: 3.2.2
istanbul-lib-report: 3.0.1
@@ -920,46 +920,46 @@ snapshots:
obug: 2.1.4
std-env: 4.2.0
tinyrainbow: 3.1.1
vitest: 4.1.10(@vitest/coverage-v8@4.1.10)(vite@8.2.1(yaml@2.9.0))
vitest: 4.1.11(@vitest/coverage-v8@4.1.11)(vite@8.2.1(yaml@2.9.0))
'@vitest/expect@4.1.10':
'@vitest/expect@4.1.11':
dependencies:
'@standard-schema/spec': 1.1.0
'@types/chai': 5.2.3
'@vitest/spy': 4.1.10
'@vitest/utils': 4.1.10
'@vitest/spy': 4.1.11
'@vitest/utils': 4.1.11
chai: 6.2.2
tinyrainbow: 3.1.1
'@vitest/mocker@4.1.10(vite@8.2.1(yaml@2.9.0))':
'@vitest/mocker@4.1.11(vite@8.2.1(yaml@2.9.0))':
dependencies:
'@vitest/spy': 4.1.10
'@vitest/spy': 4.1.11
estree-walker: 3.0.3
magic-string: 0.30.21
optionalDependencies:
vite: 8.2.1(yaml@2.9.0)
'@vitest/pretty-format@4.1.10':
'@vitest/pretty-format@4.1.11':
dependencies:
tinyrainbow: 3.1.1
'@vitest/runner@4.1.10':
'@vitest/runner@4.1.11':
dependencies:
'@vitest/utils': 4.1.10
'@vitest/utils': 4.1.11
pathe: 2.0.3
'@vitest/snapshot@4.1.10':
'@vitest/snapshot@4.1.11':
dependencies:
'@vitest/pretty-format': 4.1.10
'@vitest/utils': 4.1.10
'@vitest/pretty-format': 4.1.11
'@vitest/utils': 4.1.11
magic-string: 0.30.21
pathe: 2.0.3
'@vitest/spy@4.1.10': {}
'@vitest/spy@4.1.11': {}
'@vitest/utils@4.1.10':
'@vitest/utils@4.1.11':
dependencies:
'@vitest/pretty-format': 4.1.10
'@vitest/pretty-format': 4.1.11
convert-source-map: 2.0.0
tinyrainbow: 3.1.1
@@ -1360,15 +1360,15 @@ snapshots:
fsevents: 2.3.3
yaml: 2.9.0
vitest@4.1.10(@vitest/coverage-v8@4.1.10)(vite@8.2.1(yaml@2.9.0)):
vitest@4.1.11(@vitest/coverage-v8@4.1.11)(vite@8.2.1(yaml@2.9.0)):
dependencies:
'@vitest/expect': 4.1.10
'@vitest/mocker': 4.1.10(vite@8.2.1(yaml@2.9.0))
'@vitest/pretty-format': 4.1.10
'@vitest/runner': 4.1.10
'@vitest/snapshot': 4.1.10
'@vitest/spy': 4.1.10
'@vitest/utils': 4.1.10
'@vitest/expect': 4.1.11
'@vitest/mocker': 4.1.11(vite@8.2.1(yaml@2.9.0))
'@vitest/pretty-format': 4.1.11
'@vitest/runner': 4.1.11
'@vitest/snapshot': 4.1.11
'@vitest/spy': 4.1.11
'@vitest/utils': 4.1.11
es-module-lexer: 2.3.1
expect-type: 1.4.0
magic-string: 0.30.21
@@ -1383,7 +1383,7 @@ snapshots:
vite: 8.2.1(yaml@2.9.0)
why-is-node-running: 2.3.0
optionalDependencies:
'@vitest/coverage-v8': 4.1.10(vitest@4.1.10)
'@vitest/coverage-v8': 4.1.11(vitest@4.1.11)
transitivePeerDependencies:
- msw
+6 -15
View File
@@ -5,20 +5,11 @@
"config:recommended",
":automergeLinters"
],
"packageRules": [
{
"matchManagers": [
"pnpm"
],
"postUpgradeTasks": {
"commands": [
"pnpm install --frozen-lockfile",
"pnpm run build"
],
"fileFilters": [
"dist/index.js"
]
}
}
"rebaseWhen": "behind-base-branch",
"branchConcurrentLimit": 2,
"prConcurrentLimit": 2,
"gitIgnoredAuthors": [
"github-actions[bot]@users.noreply.github.com",
"bot@horstenkamp.eu"
]
}