@solana-epic/github-action 0.1.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/action.yml +25 -0
- package/dist/github.d.ts +3 -0
- package/dist/github.d.ts.map +1 -0
- package/dist/github.js +106 -0
- package/dist/github.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32252 -0
- package/dist/index.js.map +1 -0
- package/dist/report.d.ts +4 -0
- package/dist/report.d.ts.map +1 -0
- package/dist/report.js +133 -0
- package/dist/report.js.map +1 -0
- package/package.json +26 -0
- package/src/github.ts +81 -0
- package/src/index.ts +66 -0
- package/src/report.ts +143 -0
- package/test/report.test.mjs +107 -0
package/action.yml
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
name: 'Solana EPIC Upgrade Guard'
|
|
2
|
+
description: 'Analyze Solana program upgrade impact and verify state layout compatibility'
|
|
3
|
+
author: 'Solana EPIC'
|
|
4
|
+
inputs:
|
|
5
|
+
github_token:
|
|
6
|
+
description: 'GitHub Token for posting pull request comments (e.g. ${{ secrets.GITHUB_TOKEN }})'
|
|
7
|
+
required: true
|
|
8
|
+
old_path:
|
|
9
|
+
description: 'Path to the old program version (source directory or JSON IDL file)'
|
|
10
|
+
required: true
|
|
11
|
+
new_path:
|
|
12
|
+
description: 'Path to the new program version (source directory or JSON IDL file)'
|
|
13
|
+
required: true
|
|
14
|
+
fail_on_severity:
|
|
15
|
+
description: 'Minimum severity level to trigger a non-zero exit code (Safe, Minor, Major, Critical)'
|
|
16
|
+
required: false
|
|
17
|
+
default: 'Critical'
|
|
18
|
+
outputs:
|
|
19
|
+
severity:
|
|
20
|
+
description: 'Overall upgrade severity (Safe, Minor, Major, Critical)'
|
|
21
|
+
findings_count:
|
|
22
|
+
description: 'Number of detected upgrade findings'
|
|
23
|
+
runs:
|
|
24
|
+
using: 'node20'
|
|
25
|
+
main: 'dist/index.js'
|
package/dist/github.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../src/github.ts"],"names":[],"mappings":"AAGA,wBAAsB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA6C1F;AAED,wBAAsB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CA6B1E"}
|
package/dist/github.js
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.upsertPRComment = upsertPRComment;
|
|
37
|
+
exports.checkIfConfigChanged = checkIfConfigChanged;
|
|
38
|
+
const github = __importStar(require("@actions/github"));
|
|
39
|
+
const core = __importStar(require("@actions/core"));
|
|
40
|
+
async function upsertPRComment(token, reportMarkdown) {
|
|
41
|
+
const context = github.context;
|
|
42
|
+
if (!context.payload.pull_request) {
|
|
43
|
+
core.info("Not a pull request event. Skipping comment posting.");
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const prNumber = context.payload.pull_request.number;
|
|
47
|
+
const owner = context.repo.owner;
|
|
48
|
+
const repo = context.repo.repo;
|
|
49
|
+
const octokit = github.getOctokit(token);
|
|
50
|
+
const commentHeader = "<!-- epic-upgrade-guard-comment -->";
|
|
51
|
+
const bodyWithHeader = `${commentHeader}\n${reportMarkdown}`;
|
|
52
|
+
core.info(`Searching for existing EPIC comments on PR #${prNumber}...`);
|
|
53
|
+
const { data: comments } = await octokit.rest.issues.listComments({
|
|
54
|
+
owner,
|
|
55
|
+
repo,
|
|
56
|
+
issue_number: prNumber,
|
|
57
|
+
per_page: 100
|
|
58
|
+
});
|
|
59
|
+
const existingComment = comments.find((comment) => comment.body?.includes(commentHeader));
|
|
60
|
+
if (existingComment) {
|
|
61
|
+
core.info(`Found existing comment (ID: ${existingComment.id}). Updating it to avoid comment spam...`);
|
|
62
|
+
await octokit.rest.issues.updateComment({
|
|
63
|
+
owner,
|
|
64
|
+
repo,
|
|
65
|
+
comment_id: existingComment.id,
|
|
66
|
+
body: bodyWithHeader
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
core.info(`No existing comment found. Creating a new one...`);
|
|
71
|
+
await octokit.rest.issues.createComment({
|
|
72
|
+
owner,
|
|
73
|
+
repo,
|
|
74
|
+
issue_number: prNumber,
|
|
75
|
+
body: bodyWithHeader
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
async function checkIfConfigChanged(token) {
|
|
80
|
+
const context = github.context;
|
|
81
|
+
if (!context.payload.pull_request) {
|
|
82
|
+
core.info("Not a pull request context. Skipping config change audit.");
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
const prNumber = context.payload.pull_request.number;
|
|
86
|
+
const owner = context.repo.owner;
|
|
87
|
+
const repo = context.repo.repo;
|
|
88
|
+
const octokit = github.getOctokit(token);
|
|
89
|
+
try {
|
|
90
|
+
core.info(`Auditing PR #${prNumber} files for modifications to epic.toml...`);
|
|
91
|
+
const { data: files } = await octokit.rest.pulls.listFiles({
|
|
92
|
+
owner,
|
|
93
|
+
repo,
|
|
94
|
+
pull_number: prNumber,
|
|
95
|
+
per_page: 100
|
|
96
|
+
});
|
|
97
|
+
const isModified = files.some(file => file.filename.endsWith("epic.toml"));
|
|
98
|
+
core.info(`Config modification audit: ${isModified ? "MODIFIED" : "UNMODIFIED"}`);
|
|
99
|
+
return isModified;
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
core.warning(`Failed to list pull request files from GitHub API: ${error}`);
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=github.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github.js","sourceRoot":"","sources":["../src/github.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,0CA6CC;AAED,oDA6BC;AA/ED,wDAA0C;AAC1C,oDAAsC;AAE/B,KAAK,UAAU,eAAe,CAAC,KAAa,EAAE,cAAsB;IACzE,MAAM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