mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-19 00:51:30 -07:00
Merge d243a88b38
into 1f21e8ce0b
This commit is contained in:
commit
353198df03
53
.github/workflows/bug-report-version.yml
vendored
Normal file
53
.github/workflows/bug-report-version.yml
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
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',
|
||||
state_reason: 'not_planned'
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user