@@ -18,60 +18,64 @@ name: Comment on PR
18
18
on :
19
19
workflow_run :
20
20
workflows :
21
- - " Check Architectures"
21
+ - ' Check Architectures'
22
22
types :
23
23
- completed
24
24
25
+ concurrency :
26
+ group : ${{ github.workflow }}-${{ github.event.number || github.ref }}
27
+ cancel-in-progress : true
28
+
25
29
jobs :
26
30
comment :
27
31
runs-on : ubuntu-latest
28
32
steps :
29
- - name : Download PR artifact
30
-
31
- with :
32
- script : |
33
- var artifacts = await github.actions.listWorkflowRunArtifacts({
34
- owner: context.repo.owner,
35
- repo: context.repo.repo,
36
- run_id: ${{github.event.workflow_run.id }},
37
- });
38
- var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
39
- return artifact.name == "pr"
40
- })[0];
41
- var download = await github.actions.downloadArtifact({
42
- owner: context.repo.owner,
43
- repo: context.repo.repo,
44
- artifact_id: matchArtifact.id,
45
- archive_format: 'zip',
46
- });
47
- var fs = require('fs');
48
- fs.writeFileSync('${{github.workspace}}/pr.zip', Buffer.from(download.data));
49
- - run : unzip pr.zip
50
- - name : Comment on PR if there is output
51
- uses : actions/github-script@v3
52
- with :
53
- github-token : ${{ secrets.GITHUB_TOKEN }}
54
- script : |
55
- var fs = require('fs');
56
- var test_output = String(fs.readFileSync('./output'));
57
- var header = "Please check if your stack/sample devfile has architectures mentioned.\n"
58
- if (test_output) {
59
- test_output = header + test_output
60
- if (fs.existsSync('./commentid')) {
61
- var comment_id = Number(fs.readFileSync('./commentid'));
62
- await github.issues.updateComment({
63
- owner: context.repo.owner,
64
- repo: context.repo.repo,
65
- comment_id: comment_id,
66
- body: test_output
67
- });
68
- } else {
69
- var issue_number = Number(fs.readFileSync('./number'));
70
- await github.issues.createComment({
71
- owner: context.repo.owner,
72
- repo: context.repo.repo,
73
- issue_number: issue_number,
74
- body: test_output
75
- });
33
+ - name : Download PR artifact
34
+
35
+ with :
36
+ script : |
37
+ var artifacts = await github.actions.listWorkflowRunArtifacts({
38
+ owner: context.repo.owner,
39
+ repo: context.repo.repo,
40
+ run_id: ${{github.event.workflow_run.id }},
41
+ });
42
+ var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
43
+ return artifact.name == "pr"
44
+ })[0];
45
+ var download = await github.actions.downloadArtifact({
46
+ owner: context.repo.owner,
47
+ repo: context.repo.repo,
48
+ artifact_id: matchArtifact.id,
49
+ archive_format: 'zip',
50
+ });
51
+ var fs = require('fs');
52
+ fs.writeFileSync('${{github.workspace}}/pr.zip', Buffer.from(download.data));
53
+ - run : unzip pr.zip
54
+ - name : Comment on PR if there is output
55
+ uses : actions/github-script@v3
56
+ with :
57
+ github-token : ${{ secrets.GITHUB_TOKEN }}
58
+ script : |
59
+ var fs = require('fs');
60
+ var test_output = String(fs.readFileSync('./output'));
61
+ var header = "Please check if your stack/sample devfile has architectures mentioned.\n"
62
+ if (test_output) {
63
+ test_output = header + test_output
64
+ if (fs.existsSync('./commentid')) {
65
+ var comment_id = Number(fs.readFileSync('./commentid'));
66
+ await github.issues.updateComment({
67
+ owner: context.repo.owner,
68
+ repo: context.repo.repo,
69
+ comment_id: comment_id,
70
+ body: test_output
71
+ });
72
+ } else {
73
+ var issue_number = Number(fs.readFileSync('./number'));
74
+ await github.issues.createComment({
75
+ owner: context.repo.owner,
76
+ repo: context.repo.repo,
77
+ issue_number: issue_number,
78
+ body: test_output
79
+ });
80
+ }
76
81
}
77
- }
0 commit comments