Fix error when evaluating

This commit is contained in:
Ryan Luu 2024-11-03 20:18:27 +00:00 committed by GitHub
parent 08377f924e
commit ff3e1c1cda
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -25,26 +25,22 @@ jobs:
const versionHeader = issueBody.match(/### Bloxstrap Version/); const versionHeader = issueBody.match(/### Bloxstrap Version/);
const versionMatch = issueBody.match(/v\d+\.\d+\.\d+/); const versionMatch = issueBody.match(/v\d+\.\d+\.\d+/);
const latestVersion = '${{ steps.read-version.outputs.version }}'; const latestVersion = '${{ steps.read-version.outputs.version }}';
if (versionHeader && !versionMatch) { if (versionHeader && !versionMatch) {
await github.rest.issues.createComment({ await github.rest.issues.createComment({
issue_number: context.issue.number, issue_number: context.issue.number,
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
body: 'Unable to find Bloxstrap version.' body: 'Please specify the Bloxstrap version you are using.'
});
}
const issueVersion = versionMatch[0];
if (issueVersion !== latestVersion) {
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `You are using an outdated version of Bloxstrap (${issueVersion}). Please update to the [latest version of Bloxstrap](https://github.com/pizzaboxer/bloxstrap/releases/latest) (${latestVersion}).`
});
return github.rest.issues.update({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
state: 'closed'
}); });
} else if (versionMatch) {
const issueVersion = versionMatch[0];
if (issueVersion !== latestVersion) {
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `You are using an outdated version of Bloxstrap (${issueVersion}). Please update to the [latest version of Bloxstrap](https://github.com/pizzaboxer/bloxstrap/releases/latest) (${latestVersion}).`
});
}
} }