Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

chg: cla followup (#5762)

teod012065218aa
diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.yml
index c2155f67ac..4b129e503b 100644
--- a/.github/workflows/cla.yml
+++ b/.github/workflows/cla.yml
@@ -12,12 +12,12 @@ name: CLA
- reopened
jobs:
cla:
- if: github.event_name == 'pull_request_target' || (github.event.issue.pull_request && startsWith(github.event.comment.body, '@macro-bot'))
+ if: github.event_name == 'pull_request_target' || (github.event.issue.pull_request && startsWith(github.event.comment.body, '/macro-cla'))
name: CLA
runs-on: namespace-profile-linux-tiny-no-cache
permissions:
issues: write
- pull-requests: write
+ pull-requests: read
statuses: write
steps:
- name: Run CLA check
@@ -79,7 +79,7 @@ jobs:
} catch (err) {
core.warning(`CLA org membership probe failed: ${err.message}`);
return setStatus(sha, 'failure',
- 'CLA infrastructure error — comment "@macro-bot check" to retry');
+ 'CLA infrastructure error — comment "/macro-cla check" to retry');
}
if (isMember) {
return setStatus(sha, 'success', 'macro-inc member — covered by CIIA');
@@ -95,7 +95,7 @@ jobs:
// Fail closed, but say why: this is an infra failure, not "unsigned".
core.warning(`CLA worker check failed: ${err.message}`);
return setStatus(sha, 'failure',
- 'CLA infrastructure error — comment "@macro-bot check" to retry');
+ 'CLA infrastructure error — comment "/macro-cla check" to retry');
}
if (result.signed) {
return setStatus(sha, 'success', `CLA ${result.version} signed`);
@@ -109,7 +109,7 @@ jobs:
} else {
const command = (context.payload.comment.body ?? '').split('\n')[0].trim();
const prNumber = context.issue.number;
- if (command === '@macro-bot /cla') {
+ if (command === '/macro-cla') {
// Invitation is a maintainer-only communication act; it does not
// touch check state (the check is already red for an unsigned
// author). Arbitrary users must not be able to make the bot ping
@@ -122,7 +122,7 @@ jobs:
`@${pr.user.login} — we'd like to merge this. Before we can, we need you to sign the`,
'Macro CLA (one time, covers all future contributions):',
`**${SIGN_URL}**`,
- 'Once signed, comment `@macro-bot check` here and the CLA check will go green.',
+ 'Once signed, comment `/macro-cla check` here and the CLA check will go green.',
].join('\n'),
});
} else {
@@ -130,9 +130,18 @@ jobs:
owner, repo, comment_id: context.payload.comment.id, content: '-1',
});
}
- } else if (command === '@macro-bot check') {
+ } else if (command === '/macro-cla check') {
const { data: pr } = await github.rest.pulls.get({ owner, repo, pull_number: prNumber });
await runCheck(pr);
+ } else {
+ // Addressed to the bot but not a command we know (a typo like
+ // "/macro-cla verify", or prose that happens to open with the
+ // mention). React so the author learns it was seen and ignored
+ // rather than silently dropped. Distinct from the '-1' above,
+ // which means "recognized, but you may not run it".
+ await github.rest.reactions.createForIssueComment({
+ owner, repo, comment_id: context.payload.comment.id, content: 'confused',
+ });
}
}
env:
diff --git a/.github/workflows/deploy_cla_worker.yml b/.github/workflows/deploy_cla_worker.yml
index 7040ab9749..ccd58b8405 100644
--- a/.github/workflows/deploy_cla_worker.yml
+++ b/.github/workflows/deploy_cla_worker.yml
@@ -13,6 +13,8 @@ jobs:
deploy:
name: Deploy to Cloudflare
runs-on: namespace-profile-linux-small
+ permissions:
+ contents: read
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 86a16aea7e..cbf86fb215 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -64,7 +64,7 @@ future contributions:
shows red — that's expected and doesn't block review.
2. Sign at **<https://macro-cla.macroverse.workers.dev/cla>** ("Sign with
GitHub"; we request no OAuth scopes, only your public identity).
-3. Comment `@macro-bot check` on your PR and the check re-runs and goes
+3. Comment `/macro-cla check` on your PR and the check re-runs and goes
green.
macro-inc org members are exempt (employee agreements already cover their
diff --git a/services/cla-worker/README.md b/services/cla-worker/README.md
index ff88d15ec8..8bbe81670d 100644
--- a/services/cla-worker/README.md
+++ b/services/cla-worker/README.md
@@ -58,9 +58,10 @@ inserted `ccla:<company>` rows.
7. In branch protection on `main`, mark the `cla` commit status as a required
check.
-> **Legal review**: CLA.md is a standard Apache-ICLA-derived draft. Have it
-> reviewed by counsel before pointing real contributors at it; if the text
-> changes, bump `CLA_VERSION` in the same commit.
+> **Changing the text**: CLA.md is the agreement contributors actually sign.
+> Never edit it without bumping `CLA_VERSION` in the same commit — a version
+> tag must never refer to two different texts, or the check would claim
+> someone agreed to words they never saw.
## Hosting
diff --git a/services/cla-worker/src/index.ts b/services/cla-worker/src/index.ts
index 14ca5a02c1..4b6d6be3b0 100644
--- a/services/cla-worker/src/index.ts
+++ b/services/cla-worker/src/index.ts
@@ -120,7 +120,7 @@ function confirmationPage(receipt: Receipt, env: Env): Response {
Macro Contributor License Agreement${who}${when}. This covers all your
future contributions — no need to sign again.</p>
<p>If a pull request of yours has a red <code>cla</code> check, comment
- <code>@macro-bot check</code> on it and the check will re-run.</p>
+ <code>/macro-cla check</code> on it and the check will re-run.</p>
<p><a href="/cla">View the agreement</a></p>`,
);
return htmlResponse(body, 200);
diff --git a/tooling/xtask/crates/xtask_workflows/src/workflows/cla.rs b/tooling/xtask/crates/xtask_workflows/src/workflows/cla.rs
index cc167f7b38..ba8df2b852 100644
--- a/tooling/xtask/crates/xtask_workflows/src/workflows/cla.rs
+++ b/tooling/xtask/crates/xtask_workflows/src/workflows/cla.rs
@@ -11,8 +11,8 @@
//! Two triggers:
//! - `pull_request_target` (opened / synchronize / reopened): set the status,
//! silently — the bot never comments unprompted.
-//! - `issue_comment` (created) on PRs: `@macro-bot /cla` (org members only)
-//! posts the signing invitation; `@macro-bot check` (anyone) re-runs the
+//! - `issue_comment` (created) on PRs: `/macro-cla` (org members only)
+//! posts the signing invitation; `/macro-cla check` (anyone) re-runs the
//! check.
//!
//! `pull_request_target` runs with base-repo secrets on fork PRs, so this job
@@ -62,11 +62,14 @@ fn cla_job() -> Job {
// command itself is exact-matched in the script.
.cond(Expression::new(
"github.event_name == 'pull_request_target' || \
- (github.event.issue.pull_request && startsWith(github.event.comment.body, '@macro-bot'))",
+ (github.event.issue.pull_request && startsWith(github.event.comment.body, '/macro-cla'))",
))
+ // Least privilege for what the script actually calls: commit statuses
+ // (write), PR comments and reactions — which are issue APIs even on a
+ // PR (write), and `pulls.get` (read only).
.permissions(Permissions {
statuses: Some(Level::Write),
- pull_requests: Some(Level::Write),
+ pull_requests: Some(Level::Read),
issues: Some(Level::Write),
..Default::default()
})
@@ -152,7 +155,7 @@ fn script() -> String {
}} catch (err) {{
core.warning(`CLA org membership probe failed: ${{err.message}}`);
return setStatus(sha, 'failure',
- 'CLA infrastructure error — comment "@macro-bot check" to retry');
+ 'CLA infrastructure error — comment "/macro-cla check" to retry');
}}
if (isMember) {{
return setStatus(sha, 'success', 'macro-inc member — covered by CIIA');
@@ -168,7 +171,7 @@ fn script() -> String {
// Fail closed, but say why: this is an infra failure, not "unsigned".
core.warning(`CLA worker check failed: ${{err.message}}`);
return setStatus(sha, 'failure',
- 'CLA infrastructure error — comment "@macro-bot check" to retry');
+ 'CLA infrastructure error — comment "/macro-cla check" to retry');
}}
if (result.signed) {{
return setStatus(sha, 'success', `CLA ${{result.version}} signed`);
@@ -182,7 +185,7 @@ fn script() -> String {
}} else {{
const command = (context.payload.comment.body ?? '').split('\n')[0].trim();
const prNumber = context.issue.number;
- if (command === '@macro-bot /cla') {{
+ if (command === '/macro-cla') {{
// Invitation is a maintainer-only communication act; it does not
// touch check state (the check is already red for an unsigned
// author). Arbitrary users must not be able to make the bot ping
@@ -195,7 +198,7 @@ fn script() -> String {
`@${{pr.user.login}} — we'd like to merge this. Before we can, we need you to sign the`,
'Macro CLA (one time, covers all future contributions):',
`**${{SIGN_URL}}**`,
- 'Once signed, comment `@macro-bot check` here and the CLA check will go green.',
+ 'Once signed, comment `/macro-cla check` here and the CLA check will go green.',
].join('\n'),
}});
}} else {{
@@ -203,9 +206,18 @@ fn script() -> String {
owner, repo, comment_id: context.payload.comment.id, content: '-1',
}});
}}
- }} else if (command === '@macro-bot check') {{
+ }} else if (command === '/macro-cla check') {{
const {{ data: pr }} = await github.rest.pulls.get({{ owner, repo, pull_number: prNumber }});
await runCheck(pr);
+ }} else {{
+ // Addressed to the bot but not a command we know (a typo like
+ // "/macro-cla verify", or prose that happens to open with the
+ // mention). React so the author learns it was seen and ignored
+ // rather than silently dropped. Distinct from the '-1' above,
+ // which means "recognized, but you may not run it".
+ await github.rest.reactions.createForIssueComment({{
+ owner, repo, comment_id: context.payload.comment.id, content: 'confused',
+ }});
}}
}}
"#}
diff --git a/tooling/xtask/crates/xtask_workflows/src/workflows/deploy_cla_worker.rs b/tooling/xtask/crates/xtask_workflows/src/workflows/deploy_cla_worker.rs
index 35a94436c8..9bfffbfc56 100644
--- a/tooling/xtask/crates/xtask_workflows/src/workflows/deploy_cla_worker.rs
+++ b/tooling/xtask/crates/xtask_workflows/src/workflows/deploy_cla_worker.rs
@@ -8,7 +8,8 @@
//! `deploy` script applies pending D1 migrations before `wrangler deploy`.
use gh_workflow::{
- Concurrency, Event, Expression, Job, Push, Run, Step, Use, Workflow, WorkflowDispatch,
+ Concurrency, Event, Expression, Job, Level, Permissions, Push, Run, Step, Use, Workflow,
+ WorkflowDispatch,
};
use crate::workflows::{runners, steps, vars};
@@ -36,6 +37,13 @@ fn deploy() -> Job {
Job::default()
.name("Deploy to Cloudflare")
.runs_on(runners::Runner::Small.to_string())
+ // Explicit least privilege rather than the repo default, which this
+ // job would otherwise inherit while holding the Cloudflare API token.
+ // Checking out the source is all it needs from GitHub.
+ .permissions(Permissions {
+ contents: Some(Level::Read),
+ ..Default::default()
+ })
.add_step(steps::checkout(false, false))
.add_step(steps::setup_bun())
.add_step(setup_node())