Repository navigation
Fix/token permissions id 20260911 #106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
02e5211
855f86c
b5d1d46
14912a7
a5e3f7d
6a42c45
c0dfff9
51f649d
988a4f6
59b175c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,5 +11,5 @@ permissions: | |
|
|
||
| jobs: | ||
| mirror: | ||
| uses: hyperpolymath/standards/.github/workflows/mirror-reusable.yml@d135b05bfc647d0c0fbfedc7e80f37ea50f49236 | ||
| uses: hyperpolymath/standards/.github/workflows/mirror-reusable.yml@5b1d00229e5e8c0c0fbfedc7e80f37ea50f49236 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ποΈ Data Integrity & Integration | π Major | β‘ Quick win π Supported by static analysisπ Script executed: #!/usr/bin/env bash
set -euo pipefail
repo_url=https://github.com/hyperpolymath/standards.git
sha=5b1d00229e5e8c0c0fbfedc7e80f37ea50f49236
tmp="$(mktemp -d)"
trap 'rm -rf "$tmp"' EXIT
git -C "$tmp" init -q
git -C "$tmp" remote add origin "$repo_url"
git -C "$tmp" fetch -q --no-tags origin "$sha"
git -C "$tmp" cat-file -e "$sha^{commit}"
git -C "$tmp" show "$sha:.github/workflows/mirror-reusable.yml" |
grep -nE 'workflow_call|secrets|inputs'Repository: hyperpolymath/ochrance Length of output: 251 π Script executed: set -euo pipefail
sha='5b1d00229e5e8c0c0fbfedc7e80f37ea50f49236'
repo='hyperpolymath/standards'
printf '%s\n' '--- commit API ---'
curl -sS -w '\nHTTP_STATUS:%{http_code}\n' \
-H 'Accept: application/vnd.github+json' \
"https://api.github.com/repos/${repo}/commits/${sha}" |
python3 -c 'import json,sys; raw=sys.stdin.read(); body,status=raw.rsplit("\nHTTP_STATUS:",1); print("status="+status.strip()); data=json.loads(body); print("sha="+str(data.get("sha"))); print("message="+str(data.get("commit",{}).get("message","")).splitlines()[0]); print("error="+str(data.get("message")) if data.get("message") else "")'
printf '%s\n' '--- tree entry at exact revision ---'
curl -sS -w '\nHTTP_STATUS:%{http_code}\n' \
-H 'Accept: application/vnd.github+json' \
"https://api.github.com/repos/${repo}/contents/.github/workflows/mirror-reusable.yml?ref=${sha}" |
python3 -c 'import json,sys; raw=sys.stdin.read(); body,status=raw.rsplit("\nHTTP_STATUS:",1); print("status="+status.strip()); data=json.loads(body); print("name="+str(data.get("name"))); print("path="+str(data.get("path"))); print("download_url="+str(data.get("download_url"))); print("error="+str(data.get("message")) if data.get("message") else "")'
printf '%s\n' '--- caller workflow ---'
cat -n .github/workflows/mirror.yml | sed -n '1,80p'Repository: hyperpolymath/ochrance Length of output: 309 π Script executed: set -u
sha='5b1d00229e5e8c0c0fbfedc7e80f37ea50f49236'
repo='hyperpolymath/standards'
tmp="$(mktemp -d)"
trap 'rm -rf "$tmp"' EXIT
for endpoint in \
"https://api.github.com/repos/${repo}/commits/${sha}" \
"https://api.github.com/repos/${repo}/contents/.github/workflows/mirror-reusable.yml?ref=${sha}"
do
body="${tmp}/body"
status="$(curl -sS -o "$body" -w '%{http_code}' -H 'Accept: application/vnd.github+json' "$endpoint")"
printf '%s\n' "--- ${endpoint} ---"
printf 'HTTP_STATUS:%s\n' "$status"
cat "$body"
printf '\n'
done
printf '%s\n' '--- caller workflow ---'
cat -n .github/workflows/mirror.yml | sed -n '1,80p'Repository: hyperpolymath/ochrance Length of output: 1249 Use an existing reusable-workflow commit. Commit π§° Toolsπͺ zizmor (1.29.0)[warning] 14-14: secrets unconditionally inherited by called workflow (secrets-inherit): this reusable workflow (secrets-inherit) π€ Prompt for AI AgentsSource: MCP tools |
||
| secrets: inherit | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ | |
| # SPDX-License-Identifier: MPL-2.0 | ||
| # | ||
| # Enforces: No TypeScript, No Go, No Python (except SaltStack), No npm | ||
| # Allows: ReScript, Deno, WASM, Rust, OCaml, Haskell, Guile/Scheme | ||
| # Allows: AffineScript, Deno, WASM, Rust, OCaml, Haskell, Guile/Scheme | ||
|
|
||
| name: RSR Anti-Pattern Check | ||
| on: | ||
|
|
@@ -160,7 +160,7 @@ jobs: | |
| - name: Check for tsconfig | ||
| run: | | ||
| if [ -f "tsconfig.json" ]; then | ||
| echo "β tsconfig.json detected - use ReScript instead" | ||
| echo "β tsconfig.json detected - use AffineScript instead" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π Maintainability & Code Quality | π‘ Minor | β‘ Quick win Use the current migration target in both workflows.
π€ Prompt for AI Agents |
||
| exit 1 | ||
| fi | ||
| echo "β No tsconfig.json" | ||
|
|
@@ -177,7 +177,7 @@ jobs: | |
| echo "ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ" | ||
| echo "β RSR Anti-Pattern Check Passed β β" | ||
| echo "β β" | ||
| echo "β Allowed: ReScript, Deno, WASM, Rust, OCaml, Haskell, β" | ||
| echo "β Allowed: AffineScript, Deno, WASM, Rust, OCaml, Haskell, β" | ||
| echo "β Guile/Scheme, SaltStack (Python) β" | ||
| echo "β β" | ||
| echo "β Blocked: TypeScript, Go, npm, Python (non-Salt) β" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π― Functional Correctness | π Major | β‘ Quick win
π Supported by static analysis
π Script executed:
Repository: hyperpolymath/ochrance
Length of output: 4648
π€ get_repo_knowledge executed:
get_repo_knowledge hyperpolymath/ochrance /tmp/coderabbit-repo-knowledge/hyperpolymath-ochrance-a11ce8dfLength of output: 1168
π Web query:
site:docs.github.com GitHub Actions gh pr merge --auto required GITHUB_TOKEN permissions Dependabot pull_request contents writeπ‘ Result:
<search_synthesis>
To use
gh pr merge --autowith theGITHUB_TOKENin a GitHub Actions workflow triggered by Dependabot, you must explicitly grant the necessary permissions within your workflow file [1][2][3]. By default, workflows triggered by Dependabot receive aGITHUB_TOKENwith read-only permissions [4][2]. To enable the token to merge pull requests, you must set thepermissionskey at the job or workflow level to includepull-requests: writeandcontents: write[2][3]. Required Configuration Example: name: Dependabot Auto-merge on: pull_request permissions: contents: write pull-requests: write jobs: dependabot: runs-on: ubuntu-latest if: github.event.pull_request.user.login == 'dependabot[bot]' steps: - name: Enable auto-merge run: gh pr merge --auto --merge "$PR_URL" env: PR_URL: ${{ github.event.pull_request.html_url }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} Important Considerations: - Merge Queues: If your repository uses a merge queue, theGITHUB_TOKENcannot add pull requests to the queue [1][3]. In this specific case, you must use a personal access token (PAT) or a GitHub App installation access token with sufficient permissions instead of theGITHUB_TOKEN[1][5][3]. - Security: Always grant the minimum permissions required [5][6]. Whilecontents: writeandpull-requests: writeare necessary for merging, ensure the workflow is scoped correctly (e.g., restricted to Dependabot-triggered events) to minimize risk [1][5][2]. - Recursive Workflows: When a workflow usesGITHUB_TOKENto modify a pull request, the resulting events generally do not trigger new recursive workflow runs, preventing infinite loops [7].</search_synthesis>
<source_evidence>
Citations:
Grant
contents: writeto theautomergejob.When the policy selects
automerge,gh pr merge --autouses the workflow token withcontents: read. GitHub requirescontents: writeandpull-requests: writefor this operation.Suggested permission scope
π€ Prompt for AI Agents
Source: MCP tools