This commit is contained in:
ai-dev
2024-11-01 21:29:05 +01:00
parent d7aa564769
commit 3201e0b9e6
6 changed files with 41 additions and 33 deletions

View File

@ -32,19 +32,5 @@ export "LOG_LEVEL=${log_level}"
# Activate the Ansible virtual environment
source /opt/ansible-venv/bin/activate
# Load configuration from Home Assistant
GITEA_URL=$(bashio::config 'gitea_url')
GITEA_TOKEN=$(bashio::config 'gitea_token')
REPOSITORY=$(bashio::config 'repository')
ACT_OPTIONS=$(bashio::config 'act_runner_options')
# Activate the Ansible virtual environment
source /opt/ansible-venv/bin/activate
# Register Act runner with Gitea (if needed)
curl -X POST "$GITEA_URL/api/v1/repos/$REPOSITORY/actions/runners" \
-H "Authorization: token $GITEA_TOKEN" \
-d '{ "name": "Act Runner", "labels": ["self-hosted"] }'
bashio::log.info "Handing over control to actrunner..."
exec /usr/local/bin/act $ACT_OPTIONS
exec exec /usr/local/bin/act_runner daemon

View File

@ -0,0 +1,16 @@
#!/command/with-contenv bashio
# shellcheck shell=bash
# ==============================================================================
# Home Assistant Community Add-on: Example
# Example init script, runs before any other service
# ==============================================================================
bashio::log.info "register act_runner !"
# Load configuration from Home Assistant
GITEA_URL=$(bashio::config 'gitea_url')
GITEA_TOKEN=$(bashio::config 'gitea_token')
RUNNER_NAME=$(bashio::config 'runner_name')
RUNNER_LABEL=$(bashio::config 'runner_label')
exec /usr/local/bin/act_runner register --no-interactive --instance ${GITEA_URL} --token ${GITEA_TOKEN} --name ${RUNNER_NAME} --labels ${RUNNER_LABEL}

View File

@ -0,0 +1 @@
oneshot

View File

@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/init-example/run