mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
Add test workflow
This commit is contained in:
parent
74733e8d9e
commit
fa5e00d6ec
71
.github/workflows/bug-report-version.yml
vendored
71
.github/workflows/bug-report-version.yml
vendored
@ -4,70 +4,15 @@ on:
|
||||
types: [opened]
|
||||
|
||||
jobs:
|
||||
check-bug-report:
|
||||
comment:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Read Bloxstrap version from .csproj
|
||||
id: read-version
|
||||
run: |
|
||||
version=$(grep -oPm1 "(?<=<Version>)[^<]+" Bloxstrap/Bloxstrap.csproj)
|
||||
echo "::set-output name=version::$version"
|
||||
|
||||
- name: Check issue body for Bloxstrap version
|
||||
uses: actions/github-script@v7
|
||||
id: check-issue
|
||||
- uses: actions/github-script@v7
|
||||
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) {
|
||||
await github.rest.issues.createComment({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: 'Please include the "### Bloxstrap Version" header in your bug report.'
|
||||
});
|
||||
return github.rest.issues.update({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
state: 'closed'
|
||||
});
|
||||
}
|
||||
|
||||
if (!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.'
|
||||
});
|
||||
return github.rest.issues.update({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
state: 'closed'
|
||||
});
|
||||
}
|
||||
|
||||
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 (${latestVersion}).`
|
||||
});
|
||||
return github.rest.issues.update({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
state: 'closed'
|
||||
});
|
||||
}
|
||||
github.rest.issues.createComment({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: '👋 Thanks for reporting!'
|
||||
})
|
Loading…
Reference in New Issue
Block a user