Switch to GITHUB_TOKEN allowing only the action to trigger an update. Not necessary if public but doesn't harm anything and can cover if private.

This commit is contained in:
Christbru 2025-10-18 20:54:55 -05:00
commit 5ca801bdd1

View file

@ -72,8 +72,8 @@ jobs:
- name: Deploy to server via SSH ☁️ - name: Deploy to server via SSH ☁️
uses: appleboy/ssh-action@v1.0.3 uses: appleboy/ssh-action@v1.0.3
env: env:
GHCR_USERNAME: ${{ secrets.GHCR_USERNAME }} RUNNER_GH_ACTOR: ${{ github.actor }}
GHCR_TOKEN: ${{ secrets.GHCR_TOKEN }} RUNNER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
host: ${{ secrets.SERVER_HOST }} host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USERNAME }} username: ${{ secrets.SERVER_USERNAME }}
@ -83,9 +83,9 @@ jobs:
cd /home/github-actions/codered-astra cd /home/github-actions/codered-astra
# wrapper to support both Docker Compose v2 and legacy v1 # wrapper to support both Docker Compose v2 and legacy v1
compose() { docker compose "$@" || docker-compose "$@"; } compose() { docker compose "$@" || docker-compose "$@"; }
# Log in to GHCR to pull private images (requires GHCR_USERNAME and GHCR_TOKEN envs) # Log in to GHCR using the run's GITHUB_TOKEN so compose can pull images.
if [ -n "$GHCR_USERNAME" ] && [ -n "$GHCR_TOKEN" ]; then if [ -n "$RUNNER_GITHUB_TOKEN" ] && [ -n "$RUNNER_GH_ACTOR" ]; then
echo "$GHCR_TOKEN" | docker login ghcr.io -u "$GHCR_USERNAME" --password-stdin echo "$RUNNER_GITHUB_TOKEN" | docker login ghcr.io -u "$RUNNER_GH_ACTOR" --password-stdin || true
fi fi
export REPO_NAME_LOWER='${{ steps.repo_name.outputs.name }}' export REPO_NAME_LOWER='${{ steps.repo_name.outputs.name }}'
export GEMINI_API_KEY='${{ secrets.GEMINI_API_KEY }}' export GEMINI_API_KEY='${{ secrets.GEMINI_API_KEY }}'