Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ dist
.gitignore
.npmrc
coverage
.env
.env*
*.log
4 changes: 2 additions & 2 deletions .github/workflows/update-codejson.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ jobs:

- name: Update code.json
id: generator
uses: DSACMS/automated-codejson-generator@main
uses: DSACMS/automated-codejson-generator@sachin/local-ai-feature
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ADMIN_TOKEN: ${{ secrets.ADMIN_PAT }}
BRANCH: "main"
SKIP_PR: "false"
ENABLE_AI: "true"

- name: Post update information
run: |
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ typings/
.yarn-integrity

# dotenv environment variables file
.env
.env*
.env.test

# parcel-bundler cache (https://parceljs.org/)
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,11 @@ SKIP_PR:
ADMIN_TOKEN:
description: "Personal Access Token with admin/write privileges for direct push. Required when SKIP_PR is true."
required: false

ENABLE_AI:
description: "Use a local AI model to draft missing fields from the README. Generated fields always go through a pull request."
required: false
default: "false"
```

### Outputs
Expand Down
9 changes: 7 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Code.json Generator
name: automated-codejson-generator
description: "Automatically generates and updates code.json metadata files for CMS repositories"
author: DSACMS

Expand Down Expand Up @@ -26,6 +26,11 @@ inputs:
required: false
default: "false"

ENABLE_AI:
description: "Use a local AI model to draft missing fields from the README. Generated fields always go through a pull request."
required: false
default: "false"

outputs:
updated:
description: "Boolean indicating whether code.json was updated"
Expand All @@ -38,7 +43,7 @@ outputs:

runs:
using: docker
image: Dockerfile
image: docker://ghcr.io/dsacms/automated-codejson-generator:v2.0.2

branding:
icon: "file-text"
Expand Down
20 changes: 6 additions & 14 deletions code.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "automated-codejson-generator",
"version": "1.2.1",
"description": "Tooling that allows for code.json creation through automation",
"longDescription": "This project provides a GitHub Action that helps federal agencies maintain their code.json files, which are required for compliance with the Federal Source Code Policy. The action automatically calculates and updates various metadata fields including labor hours, programming languages used, repository information, and timestamps. It creates pull requests with these updates, making it easier to keep code.json files accurate and up-to-date.",
"longDescription": "",
"status": "Production",
"permissions": {
"licenses": [
Expand All @@ -28,9 +28,9 @@
"forks": 4,
"clones": 0
},
"platforms": ["web", "linux"],
"categories": ["developer-tools", "automation"],
"softwareType": "standalone/backend",
"platforms": [],
"categories": [],
"softwareType": "",
"languages": ["TypeScript", "JavaScript"],
"maintenance": "internal",
"contractNumber": [],
Expand All @@ -43,23 +43,15 @@
"lastModified": "2025-10-21T21:52:17Z",
"metadataLastUpdated": "2025-10-30T22:53:09.463Z"
},
"tags": [
"cmsoss-tier2",
"metadata",
"codejson",
"ci",
"github-action",
"workflow",
"featured"
],
"tags": [],
"contact": {
"email": "opensource@cms.hhs.gov",
"name": "CMS Open Source Team"
},
"feedbackMechanism": "https://github.com/DSACMS/automated-codejson-generator/issues",
"AIUseCaseID": "0",
"localisation": false,
"repositoryType": "tools",
"repositoryType": "",
"userInput": false,
"fismaLevel": "low",
"group": "CMS/OA/DSAC",
Expand Down
71 changes: 63 additions & 8 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,73 @@
FROM node:20-alpine
ARG MODEL_REPO=unsloth/gemma-4-E2B-it-GGUF
ARG MODEL_FILE=gemma-4-E2B-it-Q4_K_M.gguf
ARG MODEL_REVISION=0314792d7f1f7e229411f620751375812bb9faf2
ARG MODEL_SHA256=740185b21d22ceb83a11c3aa62ad5842ef32c70f6096d756bbee85a1e4ec34b8

RUN apk add --no-cache go git
# stage 1: builder
# install deps and build TS
FROM node:20-bookworm AS builder

RUN go install github.com/boyter/scc/v3@v3.4.0
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /action
ENV NODE_LLAMA_CPP_SKIP_DOWNLOAD=true

COPY package*.json ./
WORKDIR /app

COPY package.json package-lock.json ./
RUN npm ci

COPY . .
RUN npm run package

# stage 2: model
# download the model GGUF and cache
FROM debian:bookworm-slim AS model
ARG MODEL_REPO
ARG MODEL_FILE
ARG MODEL_REVISION
ARG MODEL_SHA256

RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
curl \
&& rm -rf /var/lib/apt/lists/*

RUN mkdir -p /opt/models \
&& curl -fSL --retry 3 \
"https://huggingface.co/${MODEL_REPO}/resolve/${MODEL_REVISION}/${MODEL_FILE}?download=true" \
-o /opt/models/model.gguf \
&& echo "${MODEL_SHA256} /opt/models/model.gguf" | sha256sum -c -

# stage 3: runtime
# final image the action actually runs
FROM node:20-bookworm-slim AS runtime

RUN apt-get update && apt-get install -y --no-install-recommends \
git \
ca-certificates \
curl \
&& rm -rf /var/lib/apt/lists/*

# scc used for the laborHours estimate
RUN curl -fSL --retry 3 \
"https://github.com/boyter/scc/releases/download/v3.4.0/scc_Linux_x86_64.tar.gz" \
-o /tmp/scc.tar.gz \
&& echo "8f812d25c237112ea74a4285f0699b7a2c448d70c5e63e370d2d199d38b13eda /tmp/scc.tar.gz" | sha256sum -c - \
&& tar -xzf /tmp/scc.tar.gz -C /usr/local/bin scc \
&& rm /tmp/scc.tar.gz \
&& chmod +x /usr/local/bin/scc \
&& scc --version

WORKDIR /app

COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/package.json ./package.json

RUN npm run bundle
COPY --from=model /opt/models/model.gguf /opt/models/model.gguf

ENV PATH="/root/go/bin:${PATH}"
ENV ACG_MODEL_PATH=/opt/models/model.gguf

ENTRYPOINT ["node", "/action/dist/index.js"]
ENTRYPOINT ["node", "/app/dist/index.js"]
Loading
Loading