Skip to content

fix: harden repo maintenance checks - #869

Merged
keito4 merged 1 commit into
mainfrom
fix/repo-maintenance-hardening
Jun 20, 2026
Merged

fix: harden repo maintenance checks#869
keito4 merged 1 commit into
mainfrom
fix/repo-maintenance-hardening

Conversation

@keito4

@keito4 keito4 commented Jun 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • fail fast when repo-maintenance is asked to create a PR but Actions cannot create/push PR branches
  • add scheduled-maintenance and artifact-retention checks to repo-maintenance
  • let Scheduled Maintenance use CLAUDE_PR_GITHUB_TOKEN with CLAUDE_PAT fallback and make failure issue creation repo-explicit
  • reduce container security SBOM artifact retention from 90 days to 30 days

Verification

  • bash -n script/repo-maintenance.sh
  • bash -n script/lib/repo_maintenance_checks.sh
  • node --check test/repo-maintenance-actions-settings.test.js
  • bash script/repo-maintenance.sh --check-actions-pr-settings
  • bash script/repo-maintenance.sh --check-scheduled-maintenance
  • bash script/repo-maintenance.sh --check-artifact-retention
  • bash script/repo-maintenance.sh --mode check-only --skip dependencies
  • npm run format:check
  • npm run lint
  • npm run shellcheck
  • npm test
  • npm run test:integration
  • npm run workflow:sync:check
  • actionlint .github/workflows/scheduled-maintenance.yml .github/workflows/container-security.yml

Summary by CodeRabbit

  • New Features

    • Added validation checks for scheduled maintenance configuration and artifact retention enforcement
    • Added fallback authentication token support for maintenance workflows
  • Improvements

    • Reduced artifact retention period from 90 to 30 days for enhanced security posture
    • Enhanced token validation with flexible secret configuration
  • Documentation

    • Updated maintenance script CLI documentation with new check command options

@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds CLAUDE_PAT as a fallback authentication token to the scheduled-maintenance workflow (both live and template), introduces two new shell check functions (check_scheduled_maintenance_configuration, check_artifact_retention) wired into repo-maintenance.sh via new CLI flags, adds CLAUDE_BRANCH override support for PR creation, reduces SBOM artifact retention from 90 to 30 days, and expands tests and docs to cover all new paths.

Changes

Scheduled-maintenance PAT fallback, artifact retention checks, and CLAUDE_BRANCH PR creation

Layer / File(s) Summary
New shell check functions
script/lib/repo_maintenance_checks.sh
Adds check_scheduled_maintenance_configuration (validates CLAUDE_PR_GITHUB_TOKEN/CLAUDE_PAT secret presence and GH_REPO in the failure issue step) and check_artifact_retention (scans all workflow YAMLs and enforces retention-days <= 30 on every upload-artifact step).
repo-maintenance.sh: new flags, CLAUDE_BRANCH, and check routing
script/repo-maintenance.sh
Sources the new checks library; adds --check-scheduled-maintenance and --check-artifact-retention CLI flags with MODE=check-only early-exit paths; updates create_pr_if_requested to use CLAUDE_BRANCH with --head; integrates both new checks into the non-skip setup phase.
Scheduled-maintenance workflow: CLAUDE_PAT fallback and GH_REPO fix
templates/workflows/scheduled-maintenance.yml, .github/workflows/scheduled-maintenance.yml
All auth-bearing fields (token, github_token, GH_TOKEN) now use CLAUDE_PR_GITHUB_TOKEN || CLAUDE_PAT; the failure step gains GH_REPO and an updated issue body instructing users to configure either secret.
SBOM artifact retention reduced to 30 days
.github/workflows/container-security.yml
Changes retention-days for the SBOM upload from 90 to 30 to comply with the new artifact retention enforcement.
Test suite expansion
test/repo-maintenance-actions-settings.test.js, test/claude-workflow-contract.test.js
Centralizes script execution in runRepoMaintenanceScript; expands the gh stub; adds scheduledMaintenanceWorkflow() fixture and runCreatePrWithClaudeBranch() helper; replaces prior settings tests with end-to-end tests for invalid settings, CLAUDE_BRANCH PR creation, scheduled maintenance secret routing, and artifact retention-days failure. Updates contract test assertions to expect the CLAUDE_PAT fallback.
Documentation
.claude/commands/repo-maintenance.md, script/README.md
Adds the new --check-scheduled-maintenance and --check-artifact-retention flags to argument hints, required behavior bullets, and README example invocations.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • keito4/config#621: Introduced the scheduled-maintenance workflow template that this PR extends with CLAUDE_PAT fallback auth and GH_REPO in the failure step.
  • keito4/config#867: Added --check-actions-pr-settings to repo-maintenance.sh, which this PR extends with two more --check-* flags using the same pattern.
  • keito4/config#852: Established the script/repo-maintenance.sh entrypoint and mode/arg-parsing structure that this PR modifies to add the new check paths and CLAUDE_BRANCH PR creation logic.

Suggested labels

released, feature

🐇 Thirty days or bust, the SBOM must shrink,
Two secrets for tokens — no missing link!
CLAUDE_PAT steps up when the first goes astray,
New checks for retention keep bloat far away.
With CLAUDE_BRANCH in hand, the PR finds its head —
The rabbit hops proudly, no warnings to dread! 🌟

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 10.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix: harden repo maintenance checks' accurately summarizes the main objective of the PR, which is to strengthen repository maintenance checks with fail-fast behavior, new validation checks, and improved token handling.
Description check ✅ Passed The PR description is mostly complete with a clear Summary section covering the four main changes, and a comprehensive Verification section detailing test execution. However, it lacks structured Why, What, How to test, and Checklist sections matching the provided template format.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/repo-maintenance-hardening

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

test/claude-workflow-contract.test.js

Oops! Something went wrong! :(

ESLint: 10.5.0

ReferenceError: describe is not defined
at Object. (/test/eslint-config.test.js:35:1)
at Module._compile (node:internal/modules/cjs/loader:1830:14)
at Object..js (node:internal/modules/cjs/loader:1961:10)
at Module.load (node:internal/modules/cjs/loader:1553:32)
at Module._load (node:internal/modules/cjs/loader:1355:12)
at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
at loadCJSModuleWithModuleLoad (node:internal/modules/esm/translators:326:3)
at ModuleWrap. (node:internal/modules/esm/translators:231:7)
at ModuleJob.run (node:internal/modules/esm/module_job:437:25)
at async node:internal/modules/esm/loader:639:26

test/repo-maintenance-actions-settings.test.js

Oops! Something went wrong! :(

ESLint: 10.5.0

ReferenceError: describe is not defined
at Object. (/test/eslint-config.test.js:35:1)
at Module._compile (node:internal/modules/cjs/loader:1830:14)
at Object..js (node:internal/modules/cjs/loader:1961:10)
at Module.load (node:internal/modules/cjs/loader:1553:32)
at Module._load (node:internal/modules/cjs/loader:1355:12)
at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
at loadCJSModuleWithModuleLoad (node:internal/modules/esm/translators:326:3)
at ModuleWrap. (node:internal/modules/esm/translators:231:7)
at ModuleJob.run (node:internal/modules/esm/module_job:437:25)
at async node:internal/modules/esm/loader:639:26


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@claude

claude Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Claude finished @keito4's task in 0s —— View job


I'll analyze this and get back to you.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2416d48a5c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

if command -v gh >/dev/null 2>&1; then
repo="$(gh repo view --json nameWithOwner --jq '.nameWithOwner' 2>/dev/null || true)"
if [[ -n "$repo" && "$repo" != "null" ]]; then
secrets="$(gh secret list --repo "$repo" --json name --jq '.[].name' 2>/dev/null || true)"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Recognize org-level maintenance secrets

When CLAUDE_PR_GITHUB_TOKEN or CLAUDE_PAT is configured as an organization Actions secret with this repository selected, the workflow's ${{ secrets.* }} references are valid, but this check only runs gh secret list --repo and therefore only sees repository-level secrets (gh secret list treats organization secrets as a separate level). In that setup --check-scheduled-maintenance fails and tells users to add a repo secret even though scheduled maintenance would run, so the check should also account for org-level secrets or treat an absent repo secret as inconclusive.

Useful? React with 👍 / 👎.

@keito4 keito4 self-assigned this Jun 20, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.claude/commands/repo-maintenance.md:
- Line 4: The argument-hint on line 4 is missing the --check-required-workflows
flag that is documented as required behavior later in the file. Add
--check-required-workflows to the argument-hint list alongside the other
--check-* flags (--check-actions-pr-settings, --check-scheduled-maintenance,
--check-artifact-retention) to keep the command hints consistent with the
documented functionality.

In @.github/workflows/scheduled-maintenance.yml:
- Around line 46-50: The actions/checkout@v6 step in the "Checkout repository"
task persists credentials to git config by default, making the PAT token
available to all subsequent workflow steps. Since the workflow already passes
authentication explicitly via GH_TOKEN environment variables in later steps, add
persist-credentials: false as a new parameter in the checkout step's with block
to prevent implicit credential availability and enforce explicit token passing
for improved security.

In `@script/lib/repo_maintenance_checks.sh`:
- Around line 58-64: The condition at line 63 using `value + 0 > 30` coerces
non-numeric values to zero, allowing invalid entries like variable references or
expressions to bypass validation. Replace the coercive numeric comparison with
an explicit check that validates the value is a literal integer before comparing
it to 30. Add validation logic to reject cases where value contains non-numeric
characters or variable syntax like dollar signs, and report an error when
retention-days is not a proper literal integer value.

In `@templates/workflows/scheduled-maintenance.yml`:
- Around line 46-50: Add the `persist-credentials: false` parameter to the
`with:` section of the `actions/checkout` action in both the
`templates/workflows/scheduled-maintenance.yml` and
`.github/workflows/scheduled-maintenance.yml` files. This prevents the
long-lived fallback PAT token from being persisted in git config where it could
be exposed to subsequent git operations like `git ls-remote` and `git push` in
the workflow.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 01c0a3ab-ed0b-465c-beb8-8e94293cb711

📥 Commits

Reviewing files that changed from the base of the PR and between d344517 and 2416d48.

📒 Files selected for processing (9)
  • .claude/commands/repo-maintenance.md
  • .github/workflows/container-security.yml
  • .github/workflows/scheduled-maintenance.yml
  • script/README.md
  • script/lib/repo_maintenance_checks.sh
  • script/repo-maintenance.sh
  • templates/workflows/scheduled-maintenance.yml
  • test/claude-workflow-contract.test.js
  • test/repo-maintenance-actions-settings.test.js

description: Comprehensive repository maintenance - run all health checks and updates
allowed-tools: Read, Bash(script/repo-maintenance.sh:*), Bash(git:*), Bash(gh:*), Bash(npm:*), Bash(pnpm:*), Bash(jq:*), Skill
argument-hint: '[--mode full|quick|check-only] [--skip CATEGORY] [--create-pr] [--check-actions-pr-settings]'
argument-hint: '[--mode full|quick|check-only] [--skip CATEGORY] [--create-pr] [--check-actions-pr-settings] [--check-scheduled-maintenance] [--check-artifact-retention]'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Include --check-required-workflows in argument-hint.

The hint now lists new --check-* flags but omits --check-required-workflows, which is still documented as required behavior (Line 41). Keeping the hint complete avoids inconsistent command guidance.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.claude/commands/repo-maintenance.md at line 4, The argument-hint on line 4
is missing the --check-required-workflows flag that is documented as required
behavior later in the file. Add --check-required-workflows to the argument-hint
list alongside the other --check-* flags (--check-actions-pr-settings,
--check-scheduled-maintenance, --check-artifact-retention) to keep the command
hints consistent with the documented functionality.

Comment on lines 46 to +50
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
fetch-depth: 1
token: ${{ secrets.CLAUDE_PR_GITHUB_TOKEN }}
token: ${{ secrets.CLAUDE_PR_GITHUB_TOKEN || secrets.CLAUDE_PAT }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

cat -n .github/workflows/scheduled-maintenance.yml

Repository: keito4/config

Length of output: 6426


🌐 Web query:

actions/checkout v6 persist-credentials default behavior github actions

💡 Result:

For actions/checkout v6, the input persist-credentials default behavior is effectively “true” (credentials are persisted so authenticated git commands work during the job). The credentials are stored in a separate file under $RUNNER_TEMP, wired into the repo’s git config via includeIf; they are removed during post-job cleanup. To opt out, set persist-credentials: false. Details grounded in the v6 action docs: - The action documents that the auth token is persisted to enable scripts to run authenticated git commands, and that you can opt out with persist-credentials: false [1][2][3]. - The v6 documentation also states that persist-credentials now stores credentials in a separate file under $RUNNER_TEMP instead of directly in.git/config [1][2][3]. - The action’s README also notes the token is removed during post-job cleanup [1][2][3]. Important behavioral implication: - Because v6 persists credentials via git includeIf pointing at the $RUNNER_TEMP credentials file, authenticated git operations that rely on those credentials should work in the workflow after checkout, but may require compatible runner/container behavior as described by the action changes [4][5]. Answer in one line: actions/checkout@v6 persists credentials by default (persist-credentials enabled), stores them under $RUNNER_TEMP, and removes them after the job; use persist-credentials: false to disable.

Citations:


Add persist-credentials: false to the checkout step to prevent implicit credential availability.

The actions/checkout@v6 action persists credentials by default, making the PAT available to all subsequent steps via git config. Since the workflow passes authentication explicitly via GH_TOKEN environment variables where needed (lines 88, 119), add persist-credentials: false to the checkout step to enforce explicit token passing and limit unintended credential exposure.

Proposed hardening
       - name: Checkout repository
         uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
         with:
           fetch-depth: 1
+          persist-credentials: false
           token: ${{ secrets.CLAUDE_PR_GITHUB_TOKEN || secrets.CLAUDE_PAT }}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
fetch-depth: 1
token: ${{ secrets.CLAUDE_PR_GITHUB_TOKEN }}
token: ${{ secrets.CLAUDE_PR_GITHUB_TOKEN || secrets.CLAUDE_PAT }}
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
fetch-depth: 1
persist-credentials: false
token: ${{ secrets.CLAUDE_PR_GITHUB_TOKEN || secrets.CLAUDE_PAT }}
🧰 Tools
🪛 zizmor (1.25.2)

[warning] 46-50: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false

(artipacked)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/scheduled-maintenance.yml around lines 46 - 50, The
actions/checkout@v6 step in the "Checkout repository" task persists credentials
to git config by default, making the PAT token available to all subsequent
workflow steps. Since the workflow already passes authentication explicitly via
GH_TOKEN environment variables in later steps, add persist-credentials: false as
a new parameter in the checkout step's with block to prevent implicit credential
availability and enforce explicit token passing for improved security.

Source: Linters/SAST tools

Comment on lines +58 to +64
in_upload && /^[[:space:]]*retention-days:[[:space:]]*/ {
has_retention = 1
value = $0
sub(/.*retention-days:[[:space:]]*/, "", value)
sub(/[[:space:]#].*/, "", value)
if (value + 0 > 30) {
printf "%s: artifact retention-days is %s (expected <= 30)\n", file, value

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Reject non-literal retention values instead of coercing them to zero.

At Line 63, value + 0 coerces non-numeric values to 0, so entries like "90" or ${{ ... }} can slip past the <= 30 gate. Fail explicitly when retention-days is not a literal integer.

🔧 Proposed fix
       in_upload && /^[[:space:]]*retention-days:[[:space:]]*/ {
         has_retention = 1
         value = $0
         sub(/.*retention-days:[[:space:]]*/, "", value)
         sub(/[[:space:]#].*/, "", value)
-        if (value + 0 > 30) {
+        if (value !~ /^"?[0-9]+"?$/) {
+          printf "%s: artifact retention-days must be a literal integer <= 30 (found %s)\n", file, value
+          bad = 1
+          next
+        }
+        gsub(/"/, "", value)
+        if ((value + 0) > 30) {
           printf "%s: artifact retention-days is %s (expected <= 30)\n", file, value
           bad = 1
         }
         next
       }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
in_upload && /^[[:space:]]*retention-days:[[:space:]]*/ {
has_retention = 1
value = $0
sub(/.*retention-days:[[:space:]]*/, "", value)
sub(/[[:space:]#].*/, "", value)
if (value + 0 > 30) {
printf "%s: artifact retention-days is %s (expected <= 30)\n", file, value
in_upload && /^[[:space:]]*retention-days:[[:space:]]*/ {
has_retention = 1
value = $0
sub(/.*retention-days:[[:space:]]*/, "", value)
sub(/[[:space:]#].*/, "", value)
if (value !~ /^"?[0-9]+"?$/) {
printf "%s: artifact retention-days must be a literal integer <= 30 (found %s)\n", file, value
bad = 1
next
}
gsub(/"/, "", value)
if ((value + 0) > 30) {
printf "%s: artifact retention-days is %s (expected <= 30)\n", file, value
bad = 1
}
next
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@script/lib/repo_maintenance_checks.sh` around lines 58 - 64, The condition at
line 63 using `value + 0 > 30` coerces non-numeric values to zero, allowing
invalid entries like variable references or expressions to bypass validation.
Replace the coercive numeric comparison with an explicit check that validates
the value is a literal integer before comparing it to 30. Add validation logic
to reject cases where value contains non-numeric characters or variable syntax
like dollar signs, and report an error when retention-days is not a proper
literal integer value.

Comment on lines 46 to +50
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
fetch-depth: 1
token: ${{ secrets.CLAUDE_PR_GITHUB_TOKEN }}
token: ${{ secrets.CLAUDE_PR_GITHUB_TOKEN || secrets.CLAUDE_PAT }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

python - <<'PY'
from pathlib import Path

for path in [
    Path("templates/workflows/scheduled-maintenance.yml"),
    Path(".github/workflows/scheduled-maintenance.yml"),
]:
    if not path.exists():
        continue

    text = path.read_text()
    idx = text.find("uses: actions/checkout")
    if idx == -1:
        continue

    next_step = text.find("\n      - name:", idx + 1)
    block = text[idx: next_step if next_step != -1 else len(text)]

    if "secrets.CLAUDE_PR_GITHUB_TOKEN || secrets.CLAUDE_PAT" in block and "persist-credentials: false" not in block:
        print(f"{path}: checkout persists the fallback PAT credentials")
PY

rg -n -C3 '\bgit\s+(push|ls-remote)\b' --glob 'script/**' --glob '.github/workflows/**' --glob 'templates/workflows/**'

Repository: keito4/config

Length of output: 4147


Add persist-credentials: false to both workflow copies to prevent reusing the long-lived fallback PAT.

actions/checkout persists credentials by default; both templates/workflows/scheduled-maintenance.yml and .github/workflows/scheduled-maintenance.yml can use CLAUDE_PAT as a fallback, exposing a long-lived token to later Claude/npm/script commands that can read it from git config. The workflows contain git ls-remote and git push operations that would require explicit credentials if persistence is disabled.

Proposed hardening
       - name: Checkout repository
         uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
         with:
           fetch-depth: 1
+          persist-credentials: false
           token: ${{ secrets.CLAUDE_PR_GITHUB_TOKEN || secrets.CLAUDE_PAT }}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
fetch-depth: 1
token: ${{ secrets.CLAUDE_PR_GITHUB_TOKEN }}
token: ${{ secrets.CLAUDE_PR_GITHUB_TOKEN || secrets.CLAUDE_PAT }}
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
fetch-depth: 1
persist-credentials: false
token: ${{ secrets.CLAUDE_PR_GITHUB_TOKEN || secrets.CLAUDE_PAT }}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@templates/workflows/scheduled-maintenance.yml` around lines 46 - 50, Add the
`persist-credentials: false` parameter to the `with:` section of the
`actions/checkout` action in both the
`templates/workflows/scheduled-maintenance.yml` and
`.github/workflows/scheduled-maintenance.yml` files. This prevents the
long-lived fallback PAT token from being persisted in git config where it could
be exposed to subsequent git operations like `git ls-remote` and `git push` in
the workflow.

@keito4
keito4 merged commit 7e10036 into main Jun 20, 2026
26 checks passed
@keito4
keito4 deleted the fix/repo-maintenance-hardening branch June 20, 2026 11:20
@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.119.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released リリース済み

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant