Skip to content

Conversation

@mickmister
Copy link
Member

No description provided.

claude bot and others added 6 commits September 1, 2025 01:29
- Create composite action at .github/actions/build-rpi-image/action.yml
- Add configurable source_repo and version_prefix inputs
- Implement release download logic with tag prefix matching
- Place downloaded zip at correct path for updatecli scripts
- Create test workflow that calls action with jamtools/jamscribe and vjamscribe- prefix

Co-authored-by: Michael Kochell <mickmister@users.noreply.github.com>
The GitHub App doesn't have workflow permissions, so removing the test workflow file. The composite action is ready to use.
Copy link
Member Author

@mickmister mickmister left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@claude We need to do some find/replace or something to inject the action params into the updatecli file. And make sure GITHUB_TOKEN secret is available at runtime

Comment on lines 6 to 12
spec:
owner: jamtools
repository: jamscribe
token: "{{ requiredEnv `GITHUB_TOKEN` }}"
versionfilter:
kind: regex
pattern: "vjamscribe-.*$"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be parameterized from the github action's parameters

kind: shell
sourceid: newRelease
spec:
command: /home/pi/code/scripts/run_from_github_release.sh jamtools jamscribe
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same with this

spec:
owner: jamtools
repository: jamscribe
token: "{{ requiredEnv `GITHUB_TOKEN` }}"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also need to make sure we place this value into an env var available in the systemd service running this

@claude
Copy link

claude bot commented Sep 1, 2025

Claude finished @mickmister's task —— View job


Parameterizing UpdateCLI Configuration ✅

I've successfully parameterized the updatecli configuration to use the GitHub action's parameters and ensure GITHUB_TOKEN is available at runtime.

Todo List:

  • Read current updatecli configuration file to understand structure
  • Read current composite action to understand how to inject parameters
  • Modify action to template/replace hardcoded values in updatecli config
  • Ensure GITHUB_TOKEN is properly passed to systemd service environment
  • Test changes and commit

Changes Made

I've successfully added parameterization to the GitHub composite action. The key changes:

Added parameterization step in .github/actions/build-rpi-image/action.yml:

  • Extracts owner and repository from the source_repo input parameter
  • Creates /home/pi/code/secrets.env with the GITHUB_TOKEN for runtime access
  • Updates the updatecli config file to replace hardcoded values:
    • owner: jamtoolsowner: {dynamic owner}
    • repository: jamscriberepository: {dynamic repo}
    • pattern: "vjamscribe-.*$"pattern: "{version_prefix}.*$"
    • Script parameters updated to use dynamic owner/repo
  • Copies the parameterized config to /home/pi/code/updatecli_github_commit.yml where the systemd service expects it

Environment Variables:

  • The systemd service (check_github_releases.service) already references EnvironmentFile=/home/pi/code/secrets.env
  • The GITHUB_TOKEN will be available to the updatecli process at runtime
  • The updatecli config uses {{ requiredEnv \GITHUB_TOKEN` }}` which will read from the environment

Usage Example:
When you call the action with parameters like:

uses: ./.github/actions/build-rpi-image
with:
  source_repo: 'jamtools/jamscribe'  
  version_prefix: 'vjamscribe-'
  github_token: ${{ secrets.GITHUB_TOKEN }}

The updatecli configuration will be automatically updated to use those values instead of the hardcoded ones, and the GITHUB_TOKEN will be securely available to the systemd service at runtime.

--- | Branch: gh-actions-rpi-image |

…lity

- Add parameterization step to composite action that replaces hardcoded values in updatecli config
- Extract owner/repo from source_repo input parameter
- Create secrets.env file with GITHUB_TOKEN for runtime access by systemd service
- Update updatecli config to use dynamic owner, repository, version prefix, and script parameters
- Copy parameterized config to expected location at /home/pi/code/updatecli_github_commit.yml

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Michael Kochell <mickmister@users.noreply.github.com>
Comment on lines 42 to 67
- name: Find latest matching release by tag prefix
id: find_release
shell: bash
env:
GH_TOKEN: ${{ inputs.github_token }}
run: |
PREFIX="${{ inputs.version_prefix }}"
latest=$(gh release list --repo "${{ inputs.source_repo }}" --limit 100 --json tagName,publishedAt \
| jq -r --arg prefix "$PREFIX" '
map(select(.tagName | startswith($prefix)))
| sort_by(.publishedAt)
| last
| if . == null then "none" else .tagName end
')
echo "latest_tag=$latest" >> $GITHUB_OUTPUT
echo "Found latest release: $latest"

- name: Download artifact from latest release
if: steps.find_release.outputs.latest_tag != 'none'
uses: blauqs/actions-download-asset@master
with:
repo: ${{ inputs.source_repo }}
version: ${{ steps.find_release.outputs.latest_tag }}
file: dist.zip
out: previous_release.zip
token: ${{ inputs.github_token }}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@claude I think we need to strip the v from the version since it seems blauqs/actions-download-asset is prepending an additional one

ci fail logs:

Run PREFIX="vjamscribe-"
Found latest release: vjamscribe-2
Run blauqs/actions-download-asset@master
Error: Error: could not find a release with the prefix/version 'vvjamscribe-2' in 'jamtools/jamscribe'

Copy link

@claude claude bot Sep 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude finished @mickmister's task —— View job


Fixed version stripping issue

Todo List:

  • Read the current GitHub action to understand version handling
  • Identify where version stripping should occur
  • Fix the version format before passing to download action
  • Test and commit the fix

What I Fixed

The issue was in the JQ query that extracts the tag name from GitHub releases. The blauqs/actions-download-asset action automatically prepends a "v" to whatever version it receives, but our tags already include the "v" (e.g., "vjamscribe-2").

The fix: Changed .tagName to .tagName[1:] in the JQ query on line 54 of .github/actions/build-rpi-image/action.yml. This strips the first character from the tag name.

Result:

  • Before: Tag "vjamscribe-2" → Download action searches for "vvjamscribe-2" ❌
  • After: Tag "vjamscribe-2" → "jamscribe-2" → Download action searches for "vjamscribe-2" ✅

The fix has been committed and pushed. The next CI run should successfully download the release artifact without the double "v" prefix error.

--- | Branch: gh-actions-rpi-image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants