-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Expand file tree
/
Copy pathgetsentry-dispatch.js
More file actions
46 lines (40 loc) · 1.45 KB
/
getsentry-dispatch.js
File metadata and controls
46 lines (40 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/**
* List of workflows to dispatch to `getsentry`
*
* `pathFilterName` refers to the path filters in `.github/file-filters.yml` (`getsentry/paths-filter` action)
*
* TODO(billy): Refactor workflow files to be an enum so that we can integration test them. Otherwise if they are
* deleted/renamed in `getsentry`, this will fail
*/
const DISPATCHES = [
{
workflow: 'backend.yml',
pathFilterName: 'backend_all',
},
];
export async function dispatch({github, context, core, fileChanges, mergeCommitSha}) {
core.startGroup('Dispatching request to getsentry.');
await Promise.all(
DISPATCHES.map(({workflow, pathFilterName}) => {
const inputs = {
pull_request_number: `${context.payload.pull_request.number}`, // needs to be string
skip: `${fileChanges[pathFilterName] !== 'true'}`, // even though this is a boolean, it must be cast to a string
// sentrySHA is the sha getsentry should run against.
'sentry-sha': mergeCommitSha,
// prSHA is the sha actions should post commit statuses too.
'sentry-pr-sha': context.payload.pull_request.head.sha,
};
core.info(
`Sending dispatch for '${workflow}':\n${JSON.stringify(inputs, null, 2)}`
);
return github.rest.actions.createWorkflowDispatch({
owner: 'getsentry',
repo: 'getsentry',
workflow_id: workflow,
ref: 'master',
inputs,
});
})
);
core.endGroup();
}