-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
56 lines (50 loc) · 1.83 KB
/
action.yml
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
47
48
49
50
51
52
53
54
55
56
name: Rerecord Issue
author: Replay.io
description: Rerecords an issue with updated sources and comments with the results
inputs:
api-key:
description: "Replay.io API Key"
server-url:
description: "Server with new sources to use while rerecording"
runs:
using: composite
steps:
- name: "Rerecord Issue"
id: "rerecord-issue"
uses: actions/github-script@v7
with:
result-encoding: json
script: |
let apiKey = '${{ inputs.api-key }}';
if (!apiKey) {
apiKey = process.env.REPLAY_API_KEY || process.env.RECORD_REPLAY_API_KEY || null;
}
if (!apiKey) {
throw new Error("You must provide an API key for rerecording. This can be added as an environment variable named REPLAY_API_KEY or as an `api-key` input.");
}
const gap = process.env.GITHUB_ACTION_PATH;
const getIssueRecording = require(gap + '/dist/issueRecording.js');
const { owner, repo, prNumber, prRevision, recordingId } = await getIssueRecording({
github,
eventPath: process.env.GITHUB_EVENT_PATH,
repositoryName: process.env.GITHUB_REPOSITORY,
});
const ProtocolClient = require(gap + '/dist/protocolClient.js');
const client = new ProtocolClient();
const rerecordIssue = require(gap + '/dist/rerecord.js');
const data = await rerecordIssue({
client,
apiKey,
serverURL: '${{ inputs.server-url }}',
recordingId,
revision: prRevision.substring(0, 12),
});
await github.rest.issues.createComment({
owner,
repo,
issue_number: prNumber,
body: data,
});
process.exit(0);
env:
REPLAY_API_KEY: ${{ inputs.api-key }}