parent
b765bcb51f
commit
46dd5ecddd
53
.github/workflows/gradle.yml
vendored
53
.github/workflows/gradle.yml
vendored
|
|
@ -11,6 +11,8 @@ on:
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
|
permissions:
|
||||||
|
issues: write
|
||||||
concurrency:
|
concurrency:
|
||||||
group: release-${{ github.ref }}
|
group: release-${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
@ -52,6 +54,57 @@ jobs:
|
||||||
env:
|
env:
|
||||||
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }}
|
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }}
|
||||||
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
|
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
|
||||||
|
- name: Capture mod version
|
||||||
|
if: steps.check_branch.outputs.is_release == 'true'
|
||||||
|
run: echo "MOD_VERSION=$(./gradlew properties -q | grep '^version:' | awk '{print $2}')" >> $GITHUB_ENV
|
||||||
|
- name: Comment on fixed issues
|
||||||
|
if: steps.check_branch.outputs.is_release == 'true'
|
||||||
|
uses: actions/github-script@v7
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const { execSync } = require('child_process');
|
||||||
|
|
||||||
|
const branch = context.ref.replace('refs/heads/', '');
|
||||||
|
const { data: runs } = await github.rest.actions.listWorkflowRuns({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
workflow_id: 'gradle.yml',
|
||||||
|
branch,
|
||||||
|
status: 'success',
|
||||||
|
per_page: 1
|
||||||
|
});
|
||||||
|
|
||||||
|
const logArgs = runs.workflow_runs.length > 0
|
||||||
|
? `${runs.workflow_runs[0].head_sha}..${context.sha}`
|
||||||
|
: `-1 ${context.sha}`;
|
||||||
|
const log = execSync(`git log ${logArgs} --format=%s%n%b`, { encoding: 'utf8' });
|
||||||
|
|
||||||
|
const issueNumbers = new Set();
|
||||||
|
const pattern = /(?:fix(?:es|ed)?|close[sd]?|resolve[sd]?)\s+#(\d+)/gi;
|
||||||
|
let match;
|
||||||
|
while ((match = pattern.exec(log)) !== null) {
|
||||||
|
issueNumbers.add(parseInt(match[1]));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (issueNumbers.size === 0) {
|
||||||
|
console.log('No fixed issues found in commits');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const version = process.env.MOD_VERSION;
|
||||||
|
for (const issueNumber of issueNumbers) {
|
||||||
|
try {
|
||||||
|
await github.rest.issues.createComment({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
issue_number: issueNumber,
|
||||||
|
body: `The fix for this issue has been released in ModernFix ${version}`
|
||||||
|
});
|
||||||
|
console.log(`Commented on issue #${issueNumber}`);
|
||||||
|
} catch (e) {
|
||||||
|
console.log(`Could not comment on #${issueNumber}: ${e.message}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
- name: Upload Artifacts to GitHub
|
- name: Upload Artifacts to GitHub
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user