Skip to content
Merged
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
55 changes: 34 additions & 21 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33058,39 +33058,52 @@ 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
const ce = /(\[?Client Version\]?:\s*)((\d+)\.(\d+))/g;
Comment thread
SyncIt21 marked this conversation as resolved.
Outdated
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
66 changes: 42 additions & 24 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,66 @@ import {getOctokit, context} from '@actions/github'

async function run(): Promise<void> {
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: ReturnType<typeof getOctokit> = 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(
issue_body = issue_body.replace(
re,
'$1[$2](https://statbus.space/round/$2)'
)
changes = true
}

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'
}
})
//modify issue body with byond client download link
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: ReturnType<typeof getOctokit> = 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