详细分析 ▾
运行时依赖
版本
manage-secrets 技能的初始版本:通过 set-secret GitHub Actions 工作流实现环境密钥的设置或更新。需要 `AGENT_GITHUB_PAT`(具有 Actions 写入权限的 PAT)和 `MANAGE_SECRETS_GITHUB_REPO`(目标环境仓库)。触发安全工作流以更新 SOPS 加密的 `secrets.yaml` 并自动部署更改。强制执行 RBAC,仅允许授权的 GitHub 用户管理指定 persona 的密钥。包括用于监控工作流状态和关键验证规则的指南。
安装命令 点击复制
技能文档
Trigger the set-secret.yml workflow in the env repo to set or update an environment secret for this persona. The workflow decrypts the SOPS-encrypted secrets.yaml, injects the key/value under envSecrets, re-encrypts, and pushes the change — which triggers a deploy.
Required Environment Variables
AGENT_GITHUB_PAT— a fine-grained PAT with Actions write permission on the env repo. There is no fallback; the PAT must be present.MANAGE_SECRETS_GITHUB_REPO— the GitHubowner/repoof the env repo that containsset-secret.yml(e.g.,myorg/myapp-env).
if [[ -z "$AGENT_GITHUB_PAT" ]]; then
echo "ERROR: AGENT_GITHUB_PAT is not set. Cannot authenticate to trigger set-secret workflow." >&2
exit 1
fiif [[ -z "$MANAGE_SECRETS_GITHUB_REPO" ]]; then
echo "ERROR: MANAGE_SECRETS_GITHUB_REPO is not set. Cannot determine target repo." >&2
exit 1
fi
export GITHUB_TOKEN="$AGENT_GITHUB_PAT"
Trigger Set-Secret
export GITHUB_TOKEN="$AGENT_GITHUB_PAT"
gh workflow run set-secret.yml \
--repo "$MANAGE_SECRETS_GITHUB_REPO" \
-f persona= \
-f secret_key= \
-f secret_value=
Where:
is this agent's persona name. Determine it from the Tailscale hostname (tailscale status --self --json | jq -r .Self.HostName→ strip themoltbot-prefix) or the Kubernetes namespace (moltbot-)must match^[A-Z][A-Z0-9_]$(e.g.,TELEGRAM_BOT_TOKEN,GOOGLE_API_KEY)is the secret value to set
Monitor Workflow Status
After triggering, wait a few seconds then check status:
export GITHUB_TOKEN="$AGENT_GITHUB_PAT"
gh run list \
--repo "$MANAGE_SECRETS_GITHUB_REPO" \
--workflow set-secret.yml \
--limit 3
To watch a specific run until completion:
export GITHUB_TOKEN="$AGENT_GITHUB_PAT"
gh run watch \
--repo "$MANAGE_SECRETS_GITHUB_REPO"
RBAC
The workflow enforces an RBAC matrix that maps GitHub usernames to allowed personas. Each persona's GitHub user can only set secrets for its own persona; admin users have wildcard access to all personas. Check the set-secret.yml workflow source for the current RBAC matrix.
Example RBAC structure:
{
"admin-user": [""],
"bot-user[bot]": ["*"],
"persona-a-user": ["persona-a"],
"persona-b-user": ["persona-b"]
}
Important Notes
- The workflow runs with
concurrency: { group: set-secret, cancel-in-progress: false }— concurrent dispatches are serialized, not cancelled - The secret key must already be a valid uppercase env var name; the workflow rejects invalid formats
- After the workflow commits, it pushes to
main, which triggers the deploy workflow for the affected persona AGENT_GITHUB_PATandMANAGE_SECRETS_GITHUB_REPOmust be set in the environment; the skill has no fallback- If the secret value is unchanged, the workflow exits cleanly with no commit
免费技能或插件可能存在安全风险,如需更匹配、更安全的方案,建议联系付费定制