@@ -28087,6 +28087,27 @@ function getInput(name, options) {
2808728087 }
2808828088 return val.trim();
2808928089}
28090+ /**
28091+ * Gets the input value of the boolean type in the YAML 1.2 "core schema" specification.
28092+ * Support boolean input list: `true | True | TRUE | false | False | FALSE` .
28093+ * The return value is also in boolean type.
28094+ * ref: https://yaml.org/spec/1.2/spec.html#id2804923
28095+ *
28096+ * @param name name of the input to get
28097+ * @param options optional. See InputOptions.
28098+ * @returns boolean
28099+ */
28100+ function getBooleanInput(name, options) {
28101+ const trueValue = ['true', 'True', 'TRUE'];
28102+ const falseValue = ['false', 'False', 'FALSE'];
28103+ const val = getInput(name, options);
28104+ if (trueValue.includes(val))
28105+ return true;
28106+ if (falseValue.includes(val))
28107+ return false;
28108+ throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name}\n` +
28109+ `Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);
28110+ }
2809028111//-----------------------------------------------------------------------
2809128112// Results
2809228113//-----------------------------------------------------------------------
@@ -33058,39 +33079,54 @@ function getOctokit(token, options, ...additionalPlugins) {
3305833079
3305933080async function run() {
3306033081 try {
33061- // Get issue number of the payload
33082+ //get issue number of the payload
3306233083 const issue_number = context.payload.issue?.number;
33063- if (! issue_number) {
33084+ if (issue_number == undefined ) {
3306433085 setFailed('Issue number retrieval failed');
3306533086 return;
3306633087 }
33067- //github client to make requests
33068- const octokit = getOctokit(getInput('repo-token', { required: true }));
3306933088 //get issue body
33070- const response = await octokit.rest.issues.get({
33071- owner: context.repo.owner,
33072- repo: context.repo.repo,
33073- issue_number: issue_number
33074- });
33075- const issue_body = response.data.body;
33089+ let issue_body = context.payload.issue?.body;
3307633090 if (!issue_body) {
33077- setFailed('Issue body retrieval failed');
3307833091 return;
3307933092 }
33093+ //check for regex changes
33094+ let changes = false;
3308033095 //modify issue body with round link id
3308133096 const re = /(\[?Round ID\]?:\s*)(\d+)/g;
3308233097 if (issue_body.match(re)) {
33083- const new_body = issue_body.replace(re, '$1[$2](https://statbus.space/round/$2)');
33084- await octokit.rest.issues.update({
33085- owner: context.repo.owner,
33086- repo: context.repo.repo,
33087- issue_number: issue_number,
33088- body: new_body,
33089- headers: {
33090- 'X-GitHub-Api-Version': '2026-03-10'
33091- }
33092- });
33098+ issue_body = issue_body.replace(re, '$1[$2](https://statbus.space/round/$2)');
33099+ changes = true;
33100+ }
33101+ //modify issue body with byond client download link
33102+ if (getBooleanInput('format-version')) {
33103+ const ce = /(\[?Client Version\]?:\s*)((\d+)\.(\d+))/g;
33104+ if (issue_body.match(ce)) {
33105+ issue_body = issue_body.replace(ce, '$1' + //text Client Version
33106+ '$2=>' + //full client version
33107+ '[$3](https://www.byond.com/download/build/$3)/' + //major version download page
33108+ '[Windows](https://www.byond.com/download/build/$3/$2_byond_setup.zip)/' + //windows zip file with installer
33109+ '[Linux](https://www.byond.com/download/build/$3/$2_byond_linux.zip)' //linux zip folder
33110+ );
33111+ changes = true;
33112+ }
3309333113 }
33114+ //no changes
33115+ if (!changes) {
33116+ return;
33117+ }
33118+ //github client to make requests
33119+ const octokit = getOctokit(getInput('repo-token', { required: true }));
33120+ //make request to update issue body
33121+ await octokit.rest.issues.update({
33122+ owner: context.repo.owner,
33123+ repo: context.repo.repo,
33124+ issue_number: issue_number,
33125+ body: issue_body,
33126+ headers: {
33127+ 'X-GitHub-Api-Version': '2026-03-10'
33128+ }
33129+ });
3309433130 }
3309533131 catch (e) {
3309633132 setFailed(`Action failed ${e}.`);
0 commit comments