mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-22 10:31:26 -07:00
52 lines
2.0 KiB
YAML
52 lines
2.0 KiB
YAML
name: Check Bug Report Version
|
|
on:
|
|
issues:
|
|
types: [opened]
|
|
|
|
jobs:
|
|
check-version:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Get latest version
|
|
id: read-version
|
|
run: |
|
|
version=$(grep -oPm1 "(?<=<Version>)[^<]+" Bloxstrap/Bloxstrap.csproj)
|
|
echo "version=$version" >> $GITHUB_OUTPUT
|
|
|
|
- name: Check issue for Bloxstrap version
|
|
uses: actions/github-script@v7
|
|
id: check-issue
|
|
with:
|
|
script: |
|
|
const issueBody = context.payload.issue.body;
|
|
const versionHeader = issueBody.match(/### Bloxstrap Version/);
|
|
const versionMatch = issueBody.match(/v?\d+\.\d+\.\d+/);
|
|
const latestVersion = '${{ steps.read-version.outputs.version }}';
|
|
|
|
if (versionHeader && !versionMatch) {
|
|
await github.rest.issues.createComment({
|
|
issue_number: context.issue.number,
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
body: 'Please specify the Bloxstrap version you are using. Use the format `vX.Y.Z`.'
|
|
});
|
|
} 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). If you are still experiencing the bug, please reopen this issue.`
|
|
});
|
|
return github.rest.issues.update({
|
|
issue_number: context.issue.number,
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
state: 'closed'
|
|
});
|
|
}
|
|
} |