diff --git a/.github/workflows/pr-auto-response.yml b/.github/workflows/pr-auto-response.yml index df4e304..ee6e100 100644 --- a/.github/workflows/pr-auto-response.yml +++ b/.github/workflows/pr-auto-response.yml @@ -26,6 +26,8 @@ jobs: - name: Apply contributor tier label for issue author uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + env: + LABEL_POLICY_PATH: .github/label-policy.json with: script: | const script = require('./.github/workflows/scripts/pr_auto_response_contributor_tier.js'); @@ -40,8 +42,8 @@ jobs: - name: Greet first-time contributors uses: actions/first-interaction@a1db7729b356323c7988c20ed6f0d33fe31297be # v1 with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - issue-message: | + repo_token: ${{ secrets.GITHUB_TOKEN }} + issue_message: | Thanks for opening this issue. Before maintainers triage it, please confirm: @@ -50,7 +52,7 @@ jobs: - Sensitive values are redacted This helps us keep issue throughput high and response latency low. - pr-message: | + pr_message: | Thanks for contributing to ZeroClaw. For faster review, please ensure: diff --git a/.github/workflows/pr-labeler.yml b/.github/workflows/pr-labeler.yml index fff174c..8349352 100644 --- a/.github/workflows/pr-labeler.yml +++ b/.github/workflows/pr-labeler.yml @@ -42,6 +42,8 @@ jobs: - name: Apply size/risk/module labels uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 continue-on-error: true + env: + LABEL_POLICY_PATH: .github/label-policy.json with: script: | const script = require('./.github/workflows/scripts/pr_labeler.js'); diff --git a/.github/workflows/scripts/pr_auto_response_contributor_tier.js b/.github/workflows/scripts/pr_auto_response_contributor_tier.js index ff55f1e..76dc0fb 100644 --- a/.github/workflows/scripts/pr_auto_response_contributor_tier.js +++ b/.github/workflows/scripts/pr_auto_response_contributor_tier.js @@ -7,6 +7,7 @@ module.exports = async ({ github, context, core }) => { const pullRequest = context.payload.pull_request; const target = issue ?? pullRequest; async function loadContributorTierPolicy() { + const policyPath = process.env.LABEL_POLICY_PATH || ".github/label-policy.json"; const fallback = { contributorTierColor: "2ED9FF", contributorTierRules: [ @@ -20,7 +21,7 @@ module.exports = async ({ github, context, core }) => { const { data } = await github.rest.repos.getContent({ owner, repo, - path: ".github/label-policy.json", + path: policyPath, ref: context.payload.repository?.default_branch || "main", }); const json = JSON.parse(Buffer.from(data.content, "base64").toString("utf8")); @@ -34,7 +35,7 @@ module.exports = async ({ github, context, core }) => { } return { contributorTierColor, contributorTierRules }; } catch (error) { - core.warning(`failed to load .github/label-policy.json, using fallback policy: ${error.message}`); + core.warning(`failed to load ${policyPath}, using fallback policy: ${error.message}`); return fallback; } } diff --git a/.github/workflows/scripts/pr_labeler.js b/.github/workflows/scripts/pr_labeler.js index f0cce73..2269c79 100644 --- a/.github/workflows/scripts/pr_labeler.js +++ b/.github/workflows/scripts/pr_labeler.js @@ -22,6 +22,7 @@ if ((action === "labeled" || action === "unlabeled") && !managedEnforcedLabels.h } async function loadContributorTierPolicy() { + const policyPath = process.env.LABEL_POLICY_PATH || ".github/label-policy.json"; const fallback = { contributorTierColor: "2ED9FF", contributorTierRules: [ @@ -35,7 +36,7 @@ async function loadContributorTierPolicy() { const { data } = await github.rest.repos.getContent({ owner, repo, - path: ".github/label-policy.json", + path: policyPath, ref: context.payload.repository?.default_branch || "main", }); const json = JSON.parse(Buffer.from(data.content, "base64").toString("utf8")); @@ -49,7 +50,7 @@ async function loadContributorTierPolicy() { } return { contributorTierColor, contributorTierRules }; } catch (error) { - core.warning(`failed to load .github/label-policy.json, using fallback policy: ${error.message}`); + core.warning(`failed to load ${policyPath}, using fallback policy: ${error.message}`); return fallback; } }