-
Notifications
You must be signed in to change notification settings - Fork 3
PR assessment workflow #140
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
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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,14 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: GitHub PR Size Assessment | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pull_request: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| types: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - closed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| assess-pr-size-on-merge: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: rainlanguage/github-chore/.github/workflows/pr-assessment.yml@main | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pr_number: ${{ github.event.pull_request.number }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| repo: ${{ github.event.repository.name }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| owner: ${{ github.repository_owner }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| merged: ${{ github.event.pull_request.merged }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+8
to
+14
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. 🛠️ Refactor suggestion Gate the job to only run when the PR is merged Triggering on pull_request.closed also fires on “closed without merge.” Add a job-level condition to avoid unnecessary runs and potential noise. jobs:
assess-pr-size-on-merge:
+ if: ${{ github.event.pull_request.merged == true }}
uses: rainlanguage/github-chore/.github/workflows/pr-assessment.yml@main
with:
pr_number: ${{ github.event.pull_request.number }}
repo: ${{ github.event.repository.name }}
owner: ${{ github.repository_owner }}
merged: ${{ github.event.pull_request.merged }}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
Comment on lines
+9
to
+14
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. 💡 Verification agent 🧩 Analysis chainConfirm the called workflow supports workflow_call and input types; add secrets: inherit if needed Ensure rainlanguage/github-chore/.github/workflows/pr-assessment.yml defines If secrets are required, update: assess-pr-size-on-merge:
if: ${{ github.event.pull_request.merged == true }}
- uses: rainlanguage/github-chore/.github/workflows/pr-assessment.yml@main
+ uses: rainlanguage/github-chore/.github/workflows/pr-assessment.yml@main
+ secrets: inherit
with:
pr_number: ${{ github.event.pull_request.number }}
repo: ${{ github.event.repository.name }}
owner: ${{ github.repository_owner }}
merged: ${{ github.event.pull_request.merged }}Script to verify the called workflow accepts these inputs: 🏁 Script executed: #!/bin/bash
set -euo pipefail
# Fetch the reusable workflow content
content=$(gh api repos/rainlanguage/github-chore/contents/.github/workflows/pr-assessment.yml \
-f ref='main' | jq -r '.content' | base64 --decode)
# Show workflow_call section and inputs
printf '%s\n' "$content" | awk '
/workflow_call:/,0 { print }
' | sed -n '1,150p'Length of output: 288 I couldn’t fetch the workflow via 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
# Download the reusable workflow
curl -fsSL \
https://raw.githubusercontent.com/rainlanguage/github-chore/main/.github/workflows/pr-assessment.yml \
-o pr-assessment.yml
echo "===== on: section ====="
grep -n 'on:' -A5 pr-assessment.yml || echo "no on: block found"
echo
echo "===== workflow_call inputs ====="
grep -n 'workflow_call:' -A20 pr-assessment.yml || echo "no workflow_call found"Length of output: 1054 Let’s verify whether 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
# Check for explicit secrets mappings
echo "=== secrets: sections ==="
grep -n 'secrets:' pr-assessment.yml || echo "No 'secrets:' sections found"
echo
# Check for any use of secrets.* in action inputs
echo "=== secrets.* usage ==="
grep -n '\${{ *secrets\.' pr-assessment.yml || echo "No secrets referenced in workflow"Length of output: 349 Add The downstream workflow defines • In your uses: rainlanguage/github-chore/.github/workflows/pr-assessment.yml@main
+ secrets: inherit
with:
pr_number: ${{ github.event.pull_request.number }}
repo: ${{ github.event.repository.name }}
owner: ${{ github.repository_owner }}
merged: ${{ github.event.pull_request.merged }}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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.
💡 Verification agent
🧩 Analysis chain
Set explicit, least-privilege GITHUB_TOKEN permissions
Reusable workflows can’t elevate permissions; the caller must declare them. Be explicit to avoid surprises if defaults change and to ensure the called workflow has what it needs.
name: GitHub PR Size Assessment on: pull_request: types: - closed + +permissions: + contents: read + pull-requests: readIf the called workflow needs additional scopes (e.g., actions: read/write, checks: write), adjust accordingly after verifying its requirements.
🏁 Script executed:
Length of output: 151
🏁 Script executed:
Length of output: 1368
Add explicit, least-privilege GITHUB_TOKEN permissions
Your workflow currently inherits default token scopes, which may change or be overly permissive. Since you’re calling a reusable workflow, you must declare its required permissions upfront. At minimum, grant read-only on repository contents and pull requests:
File: .github/workflows/pr-assessment.yaml
name: GitHub PR Size Assessment on: pull_request: types: - closed + permissions: + contents: read + pull-requests: read jobs: assess-pr-size-on-merge: uses: rainlanguage/github-chore/.github/workflows/pr-assessment.yml@main …After reviewing the reusable workflow’s needs, add any additional scopes (e.g. checks: write, actions: read/write) as required.
📝 Committable suggestion
🤖 Prompt for AI Agents