ci(skills): read the ClawHub token from the main-only clawhub environment (#7923)

This commit is contained in:
Miguel Ángel
2026-11-16 11:40:45 +00:00
committed by GitHub
parent 78648113db
commit 5d5e2c062a
2 changed files with 12 additions and 0 deletions
@@ -34,6 +34,8 @@ jobs:
name: Publish changed skills
# A dispatch runs this file from the chosen branch, so only main may reach the token.
if: github.ref == 'refs/heads/main'
# The token is an environment secret; the environment admits only main.
environment: clawhub
runs-on: ubuntu-latest
timeout-minutes: 10
env:
@@ -103,6 +103,7 @@ test("a publishing job that can be dispatched runs only for main", () => {
test("the ClawHub token reaches only the pinned CLI login step", () => {
const { source, doc } = workflows.find(({ file }) => file === "sync-skills-to-clawhub.yml");
const sync = doc.jobs.sync;
assert.equal(sync.environment, "clawhub");
assert.equal(source.match(/secrets\.CLAWHUB_TOKEN/g).length, 1);
assert.ok(!usesPublishSecret(doc.env));
assert.ok(!usesPublishSecret(sync.env));
@@ -152,3 +153,12 @@ test("dispatch arrays and OR suffixes cannot evade the main guard", () => {
);
}
});
test("a job that reads a stored secret binds an environment", () => {
const unbound = workflows.flatMap(({ file, doc }) =>
Object.entries(doc.jobs ?? {})
.filter(([, job]) => usesPublishSecret(job) && !job.environment)
.map(([name]) => `${file} ${name}`),
);
assert.deepEqual(unbound, []);
});