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
3 changes: 1 addition & 2 deletions .github/workflows/poem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@ 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
uses: actions/github-script@v6
with:
github-token: ${{ secrets.PAT_TOKEN }}
script: |
await github.rest.issues.createComment({
issue_number: context.issue.number,
Expand Down
11 changes: 0 additions & 11 deletions Dockerfile

This file was deleted.

4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,<br/>
Expand Down Expand Up @@ -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
Expand Down
39 changes: 0 additions & 39 deletions action.py

This file was deleted.

67 changes: 62 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'PR Poet'
description: 'Poestic musings for pull requests and other GitHub activity'
description: 'Poetic musings for pull requests and other GitHub activity'
author: 'Mike Lay'
branding:
icon: 'book-open'
Expand All @@ -11,8 +11,65 @@ inputs:
outputs:
poem:
description: 'The poem'
value: ${{ steps.poet.outputs.poem }}
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.message }}
using: 'composite'
steps:
- name: Restore llama CLI and model caches
uses: actions/cache@v4
with:
path: |
~/.local/bin/llama
~/.cache/huggingface
~/.cache/llama.cpp
key: pr-poet-llama-${{ runner.os }}-${{ runner.arch }}-gemma-4-e2b-q8
- name: Install llama.cpp CLI
shell: bash
run: |
if [[ ! -x "${HOME}/.local/bin/llama" ]]; then
curl -LsSf https://llama.app/install.sh | sh
fi
- name: Write poem
id: poet
shell: bash
env:
MESSAGE: ${{ inputs.message }}
run: |
system_prompt="$(cat <<'SYSTEM_PROMPT'
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.

SYSTEM_PROMPT
)"
prompt="COMMIT: ${MESSAGE}"$'\nPOEM:\n'
response="$(
"${HOME}/.local/bin/llama" completion \
-hf ggml-org/gemma-4-E2B-it-GGUF:Q8_0 \
-sys "${system_prompt}" \
-p "${prompt}" \
--jinja \
--single-turn \
--log-disable \
--no-display-prompt
)"
final_response="${response##*<channel|>}"
poem="$(printf '%s\n' "${final_response}" \
| sed 's/\[end of text\].*$//' \
| sed -nE 's/^[[:space:]]*LINE_(ONE|TWO|THREE|FOUR):[[:space:]]*//p' \
| head -n 4)"
{
echo 'poem<<EOF'
echo "${poem}"
echo 'EOF'
} >> "${GITHUB_OUTPUT}"