Skip to content

Commit a365bfc

Browse files
committed
does this action solve it
1 parent a5026ed commit a365bfc

File tree

1 file changed

+8
-33
lines changed

1 file changed

+8
-33
lines changed

.github/workflows/operator-e2e.yaml

+8-33
Original file line numberDiff line numberDiff line change
@@ -28,38 +28,13 @@ jobs:
2828
2929
steps:
3030
- name: Trigger operator E2E workflow
31-
uses: actions/github-script@v7
31+
uses: peter-evans/repository-dispatch@v3
3232
with:
33-
script: |
34-
const { Octokit } = require("@octokit/core");
35-
// Get the mirrord commit and branch based on the trigger type
36-
let mirrord_commit, mirrord_branch;
37-
38-
if (github.event_name === 'workflow_dispatch') {
39-
mirrord_commit = github.event.inputs.mirrord_commit;
40-
mirrord_branch = github.event.inputs.mirrord_branch;
41-
} else {
42-
mirrord_commit = context.sha;
43-
mirrord_branch = github.event.pull_request.head.ref;
33+
token: ${{ secrets.GITHUB_TOKEN }}
34+
repository: metalbear-co/operator
35+
event-type: operator-e2e-test-from-mirrord
36+
client-payload: |
37+
{
38+
"mirrord_commit": "${{ github.event_name == 'workflow_dispatch' && inputs.mirrord_commit || github.sha }}",
39+
"mirrord_branch": "${{ github.event_name == 'workflow_dispatch' && inputs.mirrord_branch || github.event.pull_request.head.ref }}"
4440
}
45-
console.log(`Using mirrord commit: ${mirrord_commit}`);
46-
console.log(`Using mirrord branch: ${mirrord_branch}`);
47-
48-
// Octokit.js
49-
// https://github.com/octokit/core.js#readme
50-
const octokit = new Octokit({
51-
auth: process.env.GITHUB_TOKEN
52-
})
53-
54-
await octokit.request('POST /repos/metalbear-co/operator/dispatches', {
55-
owner: 'metalbear-co',
56-
repo: 'operator',
57-
event_type: 'operator-e2e-test-from-mirrord',
58-
client_payload: {
59-
mirrord_commit,
60-
mirrord_branch
61-
},
62-
headers: {
63-
'X-GitHub-Api-Version': '2022-11-28'
64-
}
65-
})

0 commit comments

Comments
 (0)