From 8c19b153658094f22d73d1173f2d184e107e85f9 Mon Sep 17 00:00:00 2001 From: Mike Lay Date: Mon, 13 Jul 2026 18:54:22 -0700 Subject: [PATCH 1/2] New model and llama.cpp --- .github/workflows/poem.yml | 2 +- Dockerfile | 11 ------- README.md | 4 ++- action.py | 39 ---------------------- action.yml | 67 +++++++++++++++++++++++++++++++++++--- 5 files changed, 66 insertions(+), 57 deletions(-) delete mode 100644 Dockerfile delete mode 100644 action.py diff --git a/.github/workflows/poem.yml b/.github/workflows/poem.yml index afddd4f..34bc6b3 100644 --- a/.github/workflows/poem.yml +++ b/.github/workflows/poem.yml @@ -13,7 +13,7 @@ jobs: steps: - name: PR Poet id: poet - uses: mkly/pr-poet@v1.1.0 + uses: mkly/pr-poet@main with: message: ${{ github.event.pull_request.title }} - name: Post comment to PR diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 8d62aa4..0000000 --- a/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM python:3.11-slim -RUN apt-get update && apt-get install -y curl -RUN pip --no-cache-dir install ctransformers - -WORKDIR /action -ADD action.py /action -RUN curl -LO https://huggingface.co/TheBloke/orca_mini_3B-GGML/resolve/main/orca-mini-3b.ggmlv3.q4_0.bin -o /action/orca-mini-3b.ggmlv3.q4_0.bin - -ENV TRANSFORMERS_OFFLINE=1 - -ENTRYPOINT ["python", "-u", "/action/action.py"] diff --git a/README.md b/README.md index 792366b..a51ce9f 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ A Github action to turn commits and other comments into poetry +This action installs the [llama.cpp](https://github.com/ggml-org/llama.cpp) CLI in the workflow and runs [Gemma 4 E2B Q8_0](https://huggingface.co/ggml-org/gemma-4-E2B-it-GGUF). The CLI downloads the model when the action runs. + A PR title of **_Fix silly typo in readme_** would yield something similar to: > In reads that end with a whim,
@@ -33,7 +35,7 @@ jobs: steps: - name: PR Poet id: poet - uses: mkly/pr-poet@v1.0.9 + uses: mkly/pr-poet@main with: message: ${{ github.event.pull_request.title }} - name: Post comment to PR diff --git a/action.py b/action.py deleted file mode 100644 index b392919..0000000 --- a/action.py +++ /dev/null @@ -1,39 +0,0 @@ -from ctransformers import AutoModelForCausalLM, AutoConfig, Config -import re -import os - -config = AutoConfig( - model_type='llama', - config=Config( - max_new_tokens=89, - ) -) -llm = AutoModelForCausalLM.from_pretrained('/action/orca-mini-3b.ggmlv3.q4_0.bin', config=config) - -commit_message = os.getenv('INPUT_MESSAGE') - -prompt = f""" -COMMIT: Allow RSS feed to be cached if user is logged in. -POEM: -LINE_ONE: In feeds that dance on screens so bright, -LINE_TWO: A user logged, enjoys the sight, -LINE_THREE: Caching RSS, a seamless flow, -LINE_FOUR: Connection's embrace, a glow to show. - -COMMIT: Bring back try/catch for 5.1 -POEM: -LINE_ONE: In 5.1, a plea to mend, -LINE_TWO: Bring back try/catch, an old friend, -LINE_THREE: Errors caught, a graceful dance, -LINE_FOUR: Code's embrace in a second chance. - -COMMIT: {commit_message} -POEM: -""" - -result = str(llm(prompt)) -lines = result.split("\n") -poem = re.sub("LINE_ONE: |LINE_TWO: |LINE_THREE: |LINE_FOUR: ", "", "\n".join(lines[:4])) - -with open(os.getenv('GITHUB_OUTPUT', 'none.txt'), "w") as file: - file.write(f'poem<> "${GITHUB_OUTPUT}" From 00ba35fdb9b4f1ded64228dcfe52c1713a764c35 Mon Sep 17 00:00:00 2001 From: Mike Lay Date: Mon, 13 Jul 2026 20:05:24 -0700 Subject: [PATCH 2/2] Use pr token --- .github/workflows/poem.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/poem.yml b/.github/workflows/poem.yml index 34bc6b3..f71da38 100644 --- a/.github/workflows/poem.yml +++ b/.github/workflows/poem.yml @@ -19,7 +19,6 @@ jobs: - name: Post comment to PR uses: actions/github-script@v6 with: - github-token: ${{ secrets.PAT_TOKEN }} script: | await github.rest.issues.createComment({ issue_number: context.issue.number,