Skip to content

Commit 736729e

Browse files
authored
Copier update: fail on dev tag CI job (#138)
Pull in upstream template changes <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Duplicate-pull-request detection to skip redundant CI runs. * Validation workflow to ensure copier template uses a clean release tag. * CI now gates jobs conditionally and supports pull request events. * **Chores** * Devcontainer host requirements updated: 2 CPUs (runtime default 4GB; template default 10GB). * Updated devcontainer base image, VS Code extension pins, pnpm and other tooling version bumps. * Updated tag-on-merge publishing tooling. * **Documentation** * Strengthened Python tooling guidance. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 48849dd commit 736729e

19 files changed

+271
-45
lines changed

.copier-answers.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Changes here will be overwritten by Copier
2-
_commit: v0.0.106
2+
_commit: v0.0.107
33
_src_path: gh:LabAutomationAndScreening/copier-base-template.git
44
description: A web app that is hosted within a local intranet. Nuxt frontend, python
55
backend, docker-compose

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# base image tags available at https://mcr.microsoft.com/v2/devcontainers/universal/tags/list
22
# added the platform flag to override any local settings since this image is only compatible with linux/amd64. since this image is only x64 compatible, suppressing the hadolint rule
33
# hadolint ignore=DL3029
4-
FROM --platform=linux/amd64 mcr.microsoft.com/devcontainers/universal:5.1.4-noble
4+
FROM --platform=linux/amd64 mcr.microsoft.com/devcontainers/universal:5.1.5-noble
55

66
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
77

.devcontainer/devcontainer.json

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
{
2+
"hostRequirements": {
3+
"cpus": 2,
4+
"memory": "4gb"
5+
},
26
"dockerComposeFile": "docker-compose.yml",
37
"service": "devcontainer",
48
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
@@ -22,21 +26,21 @@
2226
"ms-vscode.live-server@0.5.2025051301",
2327
"MS-vsliveshare.vsliveshare@1.0.5905",
2428
"github.copilot@1.388.0",
25-
"github.copilot-chat@0.38.2026022704",
26-
"anthropic.claude-code@2.1.74",
29+
"github.copilot-chat@0.42.2026032602",
30+
"anthropic.claude-code@2.1.84",
2731

2832
// Python
29-
"ms-python.python@2026.2.2026021801",
30-
"ms-python.vscode-pylance@2026.1.1",
33+
"ms-python.python@2026.5.2026032701",
34+
"ms-python.vscode-pylance@2026.1.102",
3135
"ms-vscode-remote.remote-containers@0.414.0",
32-
"charliermarsh.ruff@2026.36.0",
36+
"charliermarsh.ruff@2026.38.0",
3337

3438
// Misc file formats
3539
"bierner.markdown-mermaid@1.29.0",
3640
"samuelcolvin.jinjahtml@0.20.0",
3741
"tamasfe.even-better-toml@0.19.2",
3842
"emilast.LogFileHighlighter@3.3.3",
39-
"esbenp.prettier-vscode@12.3.0"
43+
"esbenp.prettier-vscode@12.4.0"
4044
],
4145
"settings": {
4246
"editor.accessibilitySupport": "off", // turn off sounds
@@ -61,5 +65,5 @@
6165
"initializeCommand": "sh .devcontainer/initialize-command.sh",
6266
"onCreateCommand": "sh .devcontainer/on-create-command.sh",
6367
"postStartCommand": "sh .devcontainer/post-start-command.sh"
64-
// Devcontainer context hash (do not manually edit this, it's managed by a pre-commit hook): f6b6ee32 # spellchecker:disable-line
68+
// Devcontainer context hash (do not manually edit this, it's managed by a pre-commit hook): 80d9f36a # spellchecker:disable-line
6569
}

.devcontainer/install-ci-tooling.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from pathlib import Path
99

1010
UV_VERSION = "0.10.12"
11-
PNPM_VERSION = "10.32.1"
11+
PNPM_VERSION = "10.33.0"
1212
COPIER_VERSION = "==9.14.0"
1313
COPIER_TEMPLATE_EXTENSIONS_VERSION = "==0.3.3"
1414
PRE_COMMIT_VERSION = "4.5.1"

.devcontainer/on-create-command.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ set -ex
33

44
# For some reason the directory is not setup correctly and causes build of devcontainer to fail since
55
# it doesn't have access to the workspace directory. This can normally be done in post-start-command
6-
git config --global --add safe.directory /workspaces/copier-nuxt-python-intranet-app
6+
script_dir="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
7+
repo_root="$(CDPATH= cd -- "$script_dir/.." && pwd)"
8+
git config --global --add safe.directory "$repo_root"
79

810
sh .devcontainer/on-create-command-boilerplate.sh
911
# install json5 for merging claude settings. TODO: consider if we can install json5 globally...or somehow eliminate this dependency
10-
script_dir="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
11-
repo_root="$(CDPATH= cd -- "$script_dir/.." && pwd)"
1212
mkdir -p "$repo_root/.claude"
1313
chmod -R ug+rwX "$repo_root/.claude"
1414
chgrp -R 0 "$repo_root/.claude" || true

.devcontainer/post-start-command.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ set -ex
33

44
# For some reason the directory is not setup correctly and causes build of devcontainer to fail since
55
# it doesn't have access to the workspace directory. This can normally be done in post-start-command
6-
git config --global --add safe.directory /workspaces/copier-nuxt-python-intranet-app
6+
script_dir="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
7+
repo_root="$(CDPATH= cd -- "$script_dir/.." && pwd)"
8+
git config --global --add safe.directory "$repo_root"
79
pre-commit run merge-claude-settings -a
810
if ! bd ready; then
911
echo "It's likely the Dolt server has not yet been initialized to support beads, running that now" # TODO: figure out a better way to match this specific scenario than just a non-zero exit code...but beads still seems like in high flux right now so not sure what to tie it to
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Check Skip Duplicates
2+
description: 'Check that will output a variable to allow you to skip duplicate runs. Example: If you have both push and pull_request triggers enabled and you dont want to run 2 jobs for the same commit if a PR is already open you can add this to your jobs to skip that extra execution.'
3+
4+
outputs:
5+
should-run:
6+
description: 'Flag that determines if this execution should run or not'
7+
value: ${{ steps.check.outputs.should_run }}
8+
9+
runs:
10+
using: composite
11+
steps:
12+
- name: Check if push has associated open PR
13+
id: check
14+
env:
15+
GH_TOKEN: ${{ github.token }}
16+
REF_NAME: ${{ github.ref_name }}
17+
REPO_NAME: ${{ github.repository }}
18+
EVENT_NAME: ${{ github.event_name }}
19+
shell: bash
20+
run: |
21+
# For non-push events, always run
22+
if [ "$EVENT_NAME" != "push" ]; then
23+
echo "should_run=true" >> $GITHUB_OUTPUT
24+
echo "Event is $EVENT_NAME, will run CI"
25+
exit 0
26+
fi
27+
28+
# For push events, check if there's an open PR for this branch
29+
pr_json=$(gh pr list \
30+
--repo "$REPO_NAME" \
31+
--head "$REF_NAME" \
32+
--state open \
33+
--json number \
34+
--limit 1)
35+
36+
pr_number=$(echo "$pr_json" | jq -r '.[0].number // ""')
37+
38+
if [ -n "$pr_number" ]; then
39+
echo "should_run=false" >> $GITHUB_OUTPUT
40+
echo "Push to branch with open PR #$pr_number detected, skipping (PR event will run CI)"
41+
else
42+
echo "should_run=true" >> $GITHUB_OUTPUT
43+
echo "Push to branch without open PR, will run CI"
44+
fi

.github/workflows/ci.yaml

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
branches-ignore:
66
- 'gh-readonly-queue/**' # don't run (again) when on these special branches created during merge groups; the `on: merge_group` already triggers it.
77
merge_group:
8+
pull_request:
89

910
env:
1011
PYTHONUNBUFFERED: True
@@ -19,9 +20,23 @@ jobs:
1920
permissions:
2021
contents: write # needed for updating dependabot branches
2122

23+
check-skip-duplicate:
24+
runs-on: ubuntu-24.04
25+
outputs:
26+
should-run: ${{ steps.check.outputs.should-run }}
27+
steps:
28+
- name: Checkout code
29+
uses: actions/checkout@v6.0.2
30+
with:
31+
persist-credentials: false
32+
- id: check
33+
uses: ./.github/actions/check-skip-duplicates
34+
2235
pre-commit:
2336
needs:
2437
- get-values
38+
- check-skip-duplicate
39+
if: needs.check-skip-duplicate.outputs.should-run == 'true'
2540
uses: ./.github/workflows/pre-commit.yaml
2641
permissions:
2742
contents: write # needed for mutex
@@ -32,6 +47,8 @@ jobs:
3247
unit-test:
3348
needs:
3449
- pre-commit
50+
- check-skip-duplicate
51+
if: needs.check-skip-duplicate.outputs.should-run == 'true'
3552
strategy:
3653
matrix:
3754
os:
@@ -66,6 +83,8 @@ jobs:
6683
lint-matrix:
6784
needs:
6885
- pre-commit
86+
- check-skip-duplicate
87+
if: needs.check-skip-duplicate.outputs.should-run == 'true'
6988
strategy:
7089
matrix:
7190
os:
@@ -177,11 +196,18 @@ jobs:
177196
name: pre-commit-log--${{ github.jobs.lint-matrix.name }}
178197
path: "${{ github.workspace }}/.precommit_cache/pre-commit.log"
179198

180-
required-check:
199+
confirm-on-tagged-copier-template:
200+
if: ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }}
201+
uses: ./.github/workflows/confirm-on-tagged-copier-template.yaml
202+
203+
204+
workflow-summary:
181205
runs-on: ubuntu-24.04
182206
timeout-minutes: 2
183207
needs:
184208
- get-values
209+
- check-skip-duplicate
210+
- confirm-on-tagged-copier-template
185211
- pre-commit
186212
- unit-test
187213
- lint-matrix
@@ -194,13 +220,27 @@ jobs:
194220
success_pattern="^(skipped|success)$" # these are the possibilities: https://docs.github.com/en/actions/reference/workflows-and-actions/contexts#needs-context
195221
196222
if [[ ! "${{ needs.get-values.result }}" =~ $success_pattern ]] ||
223+
[[ ! "${{ needs.confirm-on-tagged-copier-template.result }}" =~ $success_pattern ]] ||
224+
[[ ! "${{ needs.check-skip-duplicate.result }}" =~ $success_pattern ]] ||
197225
[[ ! "${{ needs.pre-commit.result }}" =~ $success_pattern ]] ||
198226
[[ ! "${{ needs.unit-test.result }}" =~ $success_pattern ]] ||
199227
[[ ! "${{ needs.lint-matrix.result }}" =~ $success_pattern ]]; then
200228
echo "❌ One or more jobs did not finish with skipped or success"
201229
exit 1
202230
fi
203231
echo "✅ All jobs finished with skipped or success"
232+
233+
- name: Mark the required-check as succeeded so the PR can be merged
234+
if: ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }}
235+
env:
236+
GH_TOKEN: ${{ github.token }}
237+
run: |
238+
gh api \
239+
-X POST -H "Accept: application/vnd.github.v3+json" \
240+
"${{ github.event.pull_request.statuses_url }}" \
241+
-f state=success -f context="required-check" -f description="✅ All required checks passed in the job triggered by pull_request" \
242+
-f target_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
243+
204244
- name: Mark updated dependabot hash commit as succeeded
205245
if: needs.get-values.outputs.dependabot-commit-created == 'true'
206246
env:
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Confirm using tagged copier template version
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
answers_file:
7+
description: 'Path to the copier answers file'
8+
type: string
9+
default: '.copier-answers.yml'
10+
11+
jobs:
12+
confirm-on-tagged-copier-template:
13+
runs-on: ubuntu-24.04
14+
timeout-minutes: 2
15+
name: Fail if template under development
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v6.0.2
19+
with:
20+
persist-credentials: false
21+
22+
- name: Check _commit is a clean release tag
23+
run: |
24+
ANSWERS_FILE="${{ inputs.answers_file }}"
25+
if [ ! -f "$ANSWERS_FILE" ]; then
26+
echo "Error: $ANSWERS_FILE not found"
27+
exit 1
28+
fi
29+
COMMIT_LINE=$(grep "^_commit:" "$ANSWERS_FILE")
30+
if echo "$COMMIT_LINE" | grep -q "-"; then
31+
echo "Error: $COMMIT_LINE"
32+
echo "_commit must be a clean release tag (e.g. v0.0.111), not a dev commit (e.g. v0.0.106-14-g7847d7b)"
33+
exit 1
34+
fi

.github/workflows/tag-on-merge.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ jobs:
1414
permissions:
1515
contents: write
1616
steps:
17-
- uses: actions/checkout@v6.0.1
17+
- uses: actions/checkout@v6.0.2
1818
with:
1919
ref: ${{ github.event.pull_request.merge_commit_sha }}
2020
fetch-depth: '0'
2121
persist-credentials: false
2222
- name: Bump version and push tag
23-
uses: mathieudutour/github-tag-action@a22cf08638b34d5badda920f9daf6e72c477b07b # v6.2
23+
uses: nickkostov/github-tag-action@b3aa34b4ac9c7843ee609ba5d0b0a50b962647b9 # v1.3.0 # a fork of https://github.com/mathieudutour/github-tag-action, which is still on Node 20
2424
with:
2525
github_token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)