-
Notifications
You must be signed in to change notification settings - Fork 2
ci: make caller review skill optional #164
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
Closed
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
6163c88
refactor: remove provider management from workflow runner
robbycochran c5e37a0
fix: tolerate recoverable review comment locations
robbycochran 6fe7ad1
ci: make AI review opt-out label persistent
robbycochran f20eb97
security: inject GitHub token through provider masking
robbycochran 6460db5
feat: add reusable PR review workflow
robbycochran c7c94cb
ci: close review validation gaps
robbycochran 42d1dc1
ci: pin reusable workflow revisions
robbycochran dc4b5e4
ci: make caller review skill optional
robbycochran File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| name: Harness PR review | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| harness-ref: | ||
| description: Immutable 40-character Harness commit SHA to execute | ||
| required: true | ||
| type: string | ||
| skill-path: | ||
| description: Path to the trusted review skill in the caller repository | ||
| required: false | ||
| type: string | ||
| default: '' | ||
| secrets: | ||
| VERTEX_AI_SERVICE_ACCOUNT_KEY: | ||
| required: true | ||
|
|
||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
|
|
||
| jobs: | ||
| review: | ||
| if: >- | ||
| ((github.event.action == 'labeled' || github.event.action == 'unlabeled') && github.event.label.name == 'ai-review') || | ||
| (github.event.action != 'labeled' && github.event.action != 'unlabeled' && contains(github.event.pull_request.labels.*.name, 'ai-review')) | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 15 | ||
| concurrency: | ||
| group: ai-review-${{ github.repository }}-${{ github.event.pull_request.number }} | ||
| cancel-in-progress: true | ||
| steps: | ||
| - name: Validate immutable Harness revision | ||
| env: | ||
| HARNESS_REF: ${{ inputs.harness-ref }} | ||
| run: '[[ "$HARNESS_REF" =~ ^[0-9a-f]{40}$ ]]' | ||
| # Checkout only default-branch content from the caller. The PR head is data. | ||
| - uses: actions/checkout@v7 | ||
| with: | ||
| ref: ${{ github.event.repository.default_branch }} | ||
| path: caller | ||
| persist-credentials: false | ||
| - uses: actions/checkout@v7 | ||
| with: | ||
| repository: stackrox/harness-openshell | ||
| ref: ${{ inputs.harness-ref }} | ||
| path: harness | ||
| persist-credentials: false | ||
| - name: Prepare default review skill | ||
| working-directory: harness | ||
| run: install -D -m 0644 examples/github-pr-reviewer/skills/pr-review/SKILL.md skills/pr-review/SKILL.md | ||
| - name: Install caller skill | ||
| if: inputs.skill-path != '' | ||
| env: | ||
| SKILL_PATH: ${{ inputs.skill-path }} | ||
| run: | | ||
| [[ "$SKILL_PATH" != /* && "$SKILL_PATH" != *..* ]] || exit 1 | ||
| test -f "caller/$SKILL_PATH" | ||
| install -D -m 0644 "caller/$SKILL_PATH" harness/skills/pr-review/SKILL.md | ||
| - uses: actions/setup-go@v7 | ||
| with: | ||
| go-version-file: harness/go.mod | ||
| - name: Build trusted harness | ||
| working-directory: harness | ||
| run: echo "REVIEW_DIR=$RUNNER_TEMP/ai-review" >> "$GITHUB_ENV"; make cli | ||
| - name: Check label and fetch exact diff as data | ||
| id: prepare | ||
| working-directory: harness | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| REVIEW_REPOSITORY: ${{ github.repository }} | ||
| REVIEW_PR: ${{ github.event.pull_request.number }} | ||
| REVIEW_HEAD: ${{ github.event.pull_request.head.sha }} | ||
| run: bash scripts/pr-review.sh prepare | ||
| - uses: ./harness/.github/actions/setup-openshell | ||
| if: steps.prepare.outputs.eligible == 'true' | ||
| - name: Authenticate to Google Cloud | ||
| if: steps.prepare.outputs.eligible == 'true' | ||
| uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3.0.0 | ||
| with: | ||
| project_id: ${{ vars.VERTEX_AI_PROJECT_ID }} | ||
| credentials_json: ${{ secrets.VERTEX_AI_SERVICE_ACCOUNT_KEY }} | ||
| - uses: google-github-actions/setup-gcloud@aa5489c8933f4cc7a4f7d45035b3b1440c9c10db # v3.0.1 | ||
| if: steps.prepare.outputs.eligible == 'true' | ||
| - name: Review in isolated OpenShell workspace | ||
| if: steps.prepare.outputs.eligible == 'true' | ||
| working-directory: harness | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| GITHUB_TOKEN: ${{ github.token }} | ||
| REVIEW_REPOSITORY: ${{ github.repository }} | ||
| REVIEW_PR: ${{ github.event.pull_request.number }} | ||
| REVIEW_HEAD: ${{ github.event.pull_request.head.sha }} | ||
| VERTEX_AI_PROJECT_ID: ${{ vars.VERTEX_AI_PROJECT_ID }} | ||
| VERTEX_AI_REGION: ${{ vars.VERTEX_AI_REGION }} | ||
| run: | | ||
| token="$(gcloud auth print-access-token)" | ||
| echo "::add-mask::$token" | ||
| export GOOGLE_VERTEX_AI_TOKEN="$token" | ||
| bash scripts/pr-review.sh run | ||
| - uses: actions/upload-artifact@v7 | ||
| if: always() && steps.prepare.outputs.eligible == 'true' | ||
| with: | ||
| name: ai-review-pr-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.sha }}-${{ github.run_attempt }} | ||
| path: ${{ runner.temp }}/ai-review/ | ||
| retention-days: 7 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: stackrox/harness-openshell
Length of output: 201
Remove the ignore rule or restore the audit document.
docs/code-audit.mdis missing, butREADME.mdanddocs/README.mdlink to it. The.gitignorerule also prevents a new document from being added with normal Git commands.🤖 Prompt for AI Agents
Source: Path instructions