Files
openobserve/.github/workflows/claude-auto-implement.yml
T
Ashish KolheandClaude Sonnet 4.5 a3e01f1820 fix: use local copy of reusable workflow (#9956)
### **User description**
## Testing PR for Claude Workflow Fix

This PR fixes the cross-repo workflow access issue by using a local copy
of the reusable workflow.

### Changes:
- ✅ Added local copy of `claude-auto-implement-reusable.yml` 
- ✅ Updated `claude-pr-fix.yml` to use local path
- ✅ Updated `claude-auto-implement.yml` to use local path

### Security:
- ✅ Keeps o2-enterprise workflow access at "none" (most secure)
- ✅ No organization-wide exposure
- ✅ Self-contained implementation

### Testing Plan:
1. Add `@claude_fix test the workflow` comment on this PR
2. Verify workflow runs successfully
3. Check that it can access both openobserve and o2-enterprise repos
4. If successful, mark as ready for review and merge

---
🤖 Generated with [Claude Code](https://claude.com/claude-code)


___

### **PR Type**
Enhancement


___

### **Description**
- Replace cross-repo workflow calls with dispatch events

- Switch `claude-auto-implement.yml` to dispatch pattern

- Migrate `claude-pr-fix.yml` to repository_dispatch


___

### Diagram Walkthrough


```mermaid
flowchart LR
  A["claude-auto-implement.yml"] -- "claude-impl-requested" --> C["o2-enterprise workflow"]
  B["claude-pr-fix.yml"] -- "claude-fix-requested" --> C
```



<details> <summary><h3> File Walkthrough</h3></summary>

<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Configuration
changes</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>claude-auto-implement.yml</strong><dd><code>Switch
auto-implement to repository_dispatch</code>&nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
</dd></summary>
<hr>

.github/workflows/claude-auto-implement.yml

<ul><li>Remove direct reusable workflow call<br> <li> Add dispatch step
using <code>peter-evans/repository-dispatch@v4</code><br> <li> Configure
client-payload fields for dispatch</ul>


</details>


  </td>
<td><a
href="https://github.com/openobserve/openobserve/pull/9956/files#diff-8c42c989e1898874026d7b5ee03636f42ba74bb37fb7ce62c6741cbeb1b50125">+20/-14</a>&nbsp;
</td>

</tr>

<tr>
  <td>
    <details>
<summary><strong>claude-pr-fix.yml</strong><dd><code>Migrate PR fix to
repository_dispatch</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

.github/workflows/claude-pr-fix.yml

<ul><li>Remove direct reusable workflow step<br> <li> Add dispatch step
for claude-fix-requested event<br> <li> Eliminate create-pr and status
steps</ul>


</details>


  </td>
<td><a
href="https://github.com/openobserve/openobserve/pull/9956/files#diff-38d41a683d1962f3da3e5c040ca36285ddb03170285c12bef918173d881310b0">+18/-151</a></td>

</tr>
</table></td></tr></tr></tbody></table>

</details>

___

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-11 00:51:08 +05:30

133 lines
5.0 KiB
YAML

name: Claude Auto-Implement
# Trigger on label or @claude_impl comment on issues/PRs
on:
issues:
types: [labeled]
issue_comment:
types: [created]
concurrency:
group: claude-implement-${{ github.event.issue.number }}
cancel-in-progress: false
jobs:
# Security: Check if user is a member of argocd-dev team
check-permission:
if: |
github.event.sender.type != 'Bot' && (
(github.event_name == 'issues' && github.event.label.name == 'auto-implement') ||
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude_impl'))
)
runs-on: ubuntu-latest
outputs:
authorized: ${{ steps.check.outputs.authorized }}
steps:
- name: Check team membership
id: check
uses: actions/github-script@v7
with:
github-token: ${{ secrets.E2E_DEV_CI_TOKEN }}
script: |
const team = 'argocd-dev';
const org = 'openobserve';
const username = context.actor;
try {
// Check if user is a member of the team
await github.rest.teams.getMembershipForUserInOrg({
org: org,
team_slug: team,
username: username
});
console.log(`✅ ${username} is a member of ${org}/${team}`);
core.setOutput('authorized', 'true');
} catch (error) {
if (error.status === 404) {
console.log(`❌ ${username} is NOT a member of ${org}/${team}`);
core.setOutput('authorized', 'false');
// Post a comment explaining why the workflow didn't run
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: `⚠️ @${username} You don't have permission to trigger \`@claude_impl\`. Only members of the [argocd-dev](https://github.com/orgs/openobserve/teams/argocd-dev) team can use this command.`
});
} else {
throw error;
}
}
# Prepare job for label/comment triggers - detects if PR or Issue
prepare-auto:
needs: check-permission
if: |
needs.check-permission.outputs.authorized == 'true' &&
github.event.sender.type != 'Bot' && (
(github.event_name == 'issues' && github.event.label.name == 'auto-implement') ||
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude_impl'))
)
runs-on: ubuntu-latest
outputs:
mode: ${{ steps.detect.outputs.mode }}
branch: ${{ steps.detect.outputs.branch }}
pr_number: ${{ steps.detect.outputs.pr_number }}
steps:
- name: Detect if PR or Issue
id: detect
uses: actions/github-script@v7
with:
github-token: ${{ secrets.E2E_DEV_CI_TOKEN }}
script: |
const isPR = !!context.payload.issue.pull_request;
const num = context.issue.number;
if (isPR) {
// Get PR details to get branch name
const { data: pr } = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: num
});
core.setOutput('mode', 'pr_fix');
core.setOutput('branch', pr.head.ref);
core.setOutput('pr_number', String(num));
console.log(`Detected PR #${num} on branch '${pr.head.ref}'`);
} else {
core.setOutput('mode', 'implement');
core.setOutput('branch', '');
core.setOutput('pr_number', '');
console.log(`Detected Issue #${num}`);
}
# Dispatch to o2-enterprise workflow
dispatch:
needs: [check-permission, prepare-auto]
if: |
needs.check-permission.outputs.authorized == 'true' &&
github.event.sender.type != 'Bot' && (
(github.event_name == 'issues' && github.event.label.name == 'auto-implement') ||
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude_impl'))
)
runs-on: ubuntu-latest
steps:
- name: Dispatch Claude Implement Event to o2-enterprise
uses: peter-evans/repository-dispatch@v4
with:
token: ${{ secrets.E2E_DEV_CI_TOKEN }}
repository: openobserve/o2-enterprise
event-type: claude-impl-requested
client-payload: |-
{
"source_repo": "openobserve",
"issue_number": "${{ github.event.issue.number }}",
"issue_title": ${{ toJSON(github.event.issue.title) }},
"issue_body": ${{ toJSON(github.event.issue.body) }},
"mode": "${{ needs.prepare-auto.outputs.mode }}",
"branch": "${{ needs.prepare-auto.outputs.branch }}",
"pr_number": "${{ needs.prepare-auto.outputs.pr_number }}"
}