chore(deps): update kotlin monorepo to v2 (major) #355
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: java-ci-main | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: "17" | |
distribution: "temurin" | |
cache: "maven" | |
- name: Verify with Maven | |
run: mvn --update-snapshots --batch-mode verify | |
get-duplicates: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout current branch | |
uses: actions/checkout@v4 | |
- name: Run duplicate check test on current branch | |
run: | | |
mvn test -Dtest=DuplicatedUnitsTest#getDuplicateConversions | |
mkdir -p output | |
cp target/surefire-reports/DuplicatedUnitsTest-output.txt output/current_branch.txt | |
- name: Upload current branch test results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: current-branch-duplicates | |
path: output/current_branch.txt | |
- name: Print warning on forks | |
uses: actions/github-script@v7 | |
if: github.event.pull_request.head.repo.fork == true | |
with: | |
script: | | |
const fs = require('fs'); | |
const duplicateContent = fs.readFileSync('output/current_branch.txt', 'utf8'); | |
console.log("This is a fork, skip PR comment"); | |
core.warning(duplicateContent, { file: 'versions/v1/units.json' }); | |
- name: Add Comment to Pull Request | |
uses: actions/github-script@v7 | |
if: github.event.pull_request.head.repo.name == github.repository | |
with: | |
script: | | |
const fs = require('fs'); | |
const duplicateContent = fs.readFileSync('output/current_branch.txt', 'utf8'); | |
const { owner, repo } = context.repo; | |
const issue_number = context.issue.number; | |
const { data: comments } = await github.rest.issues.listComments({ | |
owner, repo, issue_number | |
}); | |
const botComments = comments.filter(comment => comment.user.login === 'github-actions[bot]'); | |
for (const comment of botComments) { | |
await github.rest.issues.deleteComment({ | |
owner, repo, | |
comment_id: comment.id, | |
}); | |
} | |
github.rest.issues.createComment({ | |
owner, repo, issue_number, | |
body: duplicateContent | |
}) |