Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*.ts text eol=lf
*.js text eol=lf
*.json text eol = lf
*.json text eol=lf
*.yml text eol=lf
10 changes: 9 additions & 1 deletion README.MD
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
# Round ID Linker

Replaces round id's in issue body with links to statbus.
Accepted round id format :
Accepted round id formats :
```
[Round ID]: 1245
Round ID: 1245
```

Also replaces Byond client version with their respective download links to both windows & linux
Accepted client id format :
```
[Client Version]: 516.1681
Client Version: 516.1681
```

## Usage
Expand Down
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ description: 'Links Round IDs found in issue body'
inputs:
repo-token:
description: 'The GITHUB_TOKEN secret'
required: true
format-version:
description: 'byond client version number will be formatted as downloadable links'
required: false
default: true
runs:
using: 'node24'
main: 'dist/index.js'
78 changes: 57 additions & 21 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28087,6 +28087,27 @@ function getInput(name, options) {
}
return val.trim();
}
/**
* Gets the input value of the boolean type in the YAML 1.2 "core schema" specification.
* Support boolean input list: `true | True | TRUE | false | False | FALSE` .
* The return value is also in boolean type.
* ref: https://yaml.org/spec/1.2/spec.html#id2804923
*
* @param name name of the input to get
* @param options optional. See InputOptions.
* @returns boolean
*/
function getBooleanInput(name, options) {
const trueValue = ['true', 'True', 'TRUE'];
const falseValue = ['false', 'False', 'FALSE'];
const val = getInput(name, options);
if (trueValue.includes(val))
return true;
if (falseValue.includes(val))
return false;
throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name}\n` +
`Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);
}
//-----------------------------------------------------------------------
// Results
//-----------------------------------------------------------------------
Expand Down Expand Up @@ -33058,39 +33079,54 @@ function getOctokit(token, options, ...additionalPlugins) {

async function run() {
try {
// Get issue number of the payload
//get issue number of the payload
const issue_number = context.payload.issue?.number;
if (!issue_number) {
if (issue_number == undefined) {
setFailed('Issue number retrieval failed');
return;
}
//github client to make requests
const octokit = getOctokit(getInput('repo-token', { required: true }));
//get issue body
const response = await octokit.rest.issues.get({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number
});
const issue_body = response.data.body;
let issue_body = context.payload.issue?.body;
if (!issue_body) {
setFailed('Issue body retrieval failed');
return;
}
//check for regex changes
let changes = false;
//modify issue body with round link id
const re = /(\[?Round ID\]?:\s*)(\d+)/g;
if (issue_body.match(re)) {
const new_body = issue_body.replace(re, '$1[$2](https://statbus.space/round/$2)');
await octokit.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
body: new_body,
headers: {
'X-GitHub-Api-Version': '2026-03-10'
}
});
issue_body = issue_body.replace(re, '$1[$2](https://statbus.space/round/$2)');
changes = true;
}
//modify issue body with byond client download link
if (getBooleanInput('format-version')) {
const ce = /(\[?Client Version\]?:\s*)((\d+)\.(\d+))/g;
if (issue_body.match(ce)) {
issue_body = issue_body.replace(ce, '$1' + //text Client Version
'$2=>' + //full client version
'[$3](https://www.byond.com/download/build/$3)/' + //major version download page
'[Windows](https://www.byond.com/download/build/$3/$2_byond_setup.zip)/' + //windows zip file with installer
'[Linux](https://www.byond.com/download/build/$3/$2_byond_linux.zip)' //linux zip folder
);
changes = true;
}
}
//no changes
if (!changes) {
return;
}
//github client to make requests
const octokit = getOctokit(getInput('repo-token', { required: true }));
//make request to update issue body
await octokit.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
body: issue_body,
headers: {
'X-GitHub-Api-Version': '2026-03-10'
}
});
}
catch (e) {
setFailed(`Action failed ${e}.`);
Expand Down
Loading