mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-18 16:08:56 +00:00
ci(skills): read the ClawHub token from the main-only clawhub environment (#7923)
This commit is contained in:
@@ -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, []);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user