Skip to content

Add GitHub Actions workflow to build bootJar on comment#3605

Merged
nixel2007 merged 1 commit intodevelopfrom
nixel2007-patch-2
Nov 18, 2025
Merged

Add GitHub Actions workflow to build bootJar on comment#3605
nixel2007 merged 1 commit intodevelopfrom
nixel2007-patch-2

Conversation

@nixel2007
Copy link
Member

@nixel2007 nixel2007 commented Nov 18, 2025

This workflow builds a boot JAR when a comment is made on a PR. It checks out the repository, sets up JDK, builds the JAR, lists the built JARs, uploads the artifact, and comments on the PR with the JAR link.

Описание

Связанные задачи

Closes

Чеклист

Общие

  • Ветка PR обновлена из develop
  • Отладочные, закомментированные и прочие, не имеющие смысла участки кода удалены
  • Изменения покрыты тестами
  • Обязательные действия перед коммитом выполнены (запускал команду gradlew precommit)

Для диагностик

  • Описание диагностики заполнено для обоих языков (присутствуют файлы для обоих языков, для русского заполнено все подробно, перевод на английский можно опустить)

Дополнительно

Summary by CodeRabbit

  • Chores
    • Added GitHub Actions workflow enabling on-demand bootJar builds triggered by PR comments containing "/buildJar". Build artifacts are automatically uploaded and results are posted back to the pull request for easy access.

This workflow builds a boot JAR when a comment is made on a PR. It checks out the repository, sets up JDK, builds the JAR, lists the built JARs, uploads the artifact, and comments on the PR with the JAR link.
Copilot AI review requested due to automatic review settings November 18, 2025 07:09
@nixel2007
Copy link
Member Author

/buildJar

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 18, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

A new GitHub Actions workflow is introduced that automatically builds a bootJar artifact when a PR comment containing "/buildJar" is posted. The workflow checks out the code, sets up JDK 17, builds the JAR, uploads it as an artifact, and posts a comment with the artifact link.

Changes

Cohort / File(s) Summary
New GitHub Actions Workflow
.github/workflows/build-bootJar-on-comment.yaml
Introduces workflow triggered on PR comments containing "/buildJar". Sets up JDK 17 with Gradle caching, builds bootJar, validates output, generates file list, uploads artifact, and posts PR comment with artifact link and file inventory.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant GitHub as GitHub Actions
    participant Build as Build Job
    participant Artifact as Artifact Store
    participant PR as PR Comment
    
    User->>GitHub: Comment "/buildJar" on PR
    activate GitHub
    GitHub->>Build: Trigger workflow
    activate Build
    Build->>Build: Checkout repo
    Build->>Build: Setup JDK 17
    Build->>Build: Build bootJar
    alt JAR(s) found
        Build->>Build: Generate file list
        Build->>Artifact: Upload artifact
        Build->>PR: Post success comment<br/>with artifact link
    else No JARs found
        Build->>PR: Post failure comment
    end
    deactivate Build
    deactivate GitHub
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Verify workflow trigger conditions: Ensure the /buildJar comment trigger is correctly scoped to pull requests only
  • Validate artifact upload logic: Confirm that the artifact naming, upload, and link generation are functioning as intended
  • Check error handling path: Ensure the failure path when no JARs are produced is properly handled and communicated

Poem

🐰 A new workflow hops into place,
Building bootJars at a faster pace!
Comment "/buildJar" with a gleeful cheer,
Artifacts upload, success draws near! 🎉

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch nixel2007-patch-2

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 265bebd and 2d572e9.

📒 Files selected for processing (1)
  • .github/workflows/build-bootJar-on-comment.yaml (1 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@nixel2007 nixel2007 merged commit c1c84aa into develop Nov 18, 2025
36 of 37 checks passed
@nixel2007 nixel2007 deleted the nixel2007-patch-2 branch November 18, 2025 07:10
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new GitHub Actions workflow that allows building bootJar artifacts on-demand when a PR comment containing /buildJar is posted. This provides a convenient way to generate test builds from pull requests without merging or manual local builds.

Key Changes:

  • Adds build-bootJar-on-comment.yaml workflow triggered by issue comments
  • Implements /buildJar command to build and upload JAR artifacts
  • Automatically comments on PRs with links to the generated artifacts

uses: actions/checkout@v4

- name: Set up JDK 17 (Corretto) with Gradle cache
uses: actions/setup-java@v4
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow uses actions/setup-java@v4 while other workflows in the repository use actions/setup-java@v5 (see qa.yml, gradle.yml, pre-qa.yml, benchmark.yml). Please update to v5 for consistency.

Suggested change
uses: actions/setup-java@v4
uses: actions/setup-java@v5

Copilot uses AI. Check for mistakes.

- name: Upload JAR artifact
id: upload_jar
uses: actions/upload-artifact@v4
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow uses actions/upload-artifact@v4 while other workflows in the repository use actions/upload-artifact@v5 (see gradle.yml line 52, benchmark.yml line 73, pre-qa.yml line 39). Please update to v5 for consistency.

Suggested change
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v5

Copilot uses AI. Check for mistakes.
body: |
✅ Собраны JAR-файлы для этого PR по команде `/buildJar`.

**Артефакт:** [${{ steps.upload_jar.outputs.artifact-name }}](${{ steps.upload_jar.outputs.artifact-url }})
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The output artifact-name doesn't exist in actions/upload-artifact@v4 (or v5). The available outputs are:

  • artifact-id: The ID of the artifact
  • artifact-url: The URL to download the artifact

To display the artifact name, you should use the input value directly: bootJar-${{ github.run_id }} instead of ${{ steps.upload_jar.outputs.artifact-name }}.

Suggested change
**Артефакт:** [${{ steps.upload_jar.outputs.artifact-name }}](${{ steps.upload_jar.outputs.artifact-url }})
**Артефакт:** [bootJar-${{ github.run_id }}](${{ steps.upload_jar.outputs.artifact-url }})

Copilot uses AI. Check for mistakes.

permissions:
contents: read
issues: write # писать комментарии в PR (issues API)
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The permissions may be insufficient. While issues: write allows commenting on issues, for PR comments you should also consider adding pull-requests: write permission to ensure proper access to all PR-related operations. Although the issues API works for PR comments, it's more explicit and future-proof to include both permissions.

Suggested change
issues: write # писать комментарии в PR (issues API)
issues: write # писать комментарии в PR (issues API)
pull-requests: write # явное разрешение для операций с PR

Copilot uses AI. Check for mistakes.
id: list_jars
run: |
if ! ls build/libs/*.jar >/dev/null 2>&1; then
echo "No JAR found in build/libs"
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Minor spelling: In English error messages, the standard format would be "No JAR files found" rather than "No JAR found" for clarity, especially since the workflow might build multiple JAR files.

Suggested change
echo "No JAR found in build/libs"
echo "No JAR files found in build/libs"

Copilot uses AI. Check for mistakes.

steps:
- name: Checkout repository
uses: actions/checkout@v4
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow uses actions/checkout@v4 while other workflows in the repository use actions/checkout@v5 (see qa.yml, gradle.yml, pre-qa.yml, benchmark.yml, rebase.yml). Please update to v5 for consistency.

Suggested change
uses: actions/checkout@v4
uses: actions/checkout@v5

Copilot uses AI. Check for mistakes.
Comment on lines +20 to +22
steps:
- name: Checkout repository
uses: actions/checkout@v4
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Critical bug: The workflow checks out the default branch instead of the PR branch. When triggered by an issue_comment event, the checkout action doesn't automatically know which PR branch to use. You need to:

  1. Fetch the PR data using the GitHub API (similar to how qa.yml does it)
  2. Use the ref parameter in checkout to specify the PR branch

Example approach from rebase.yml:

- uses: actions/checkout@v5
  with:
    token: ${{ secrets.GITHUB_TOKEN }}
    fetch-depth: 0

Or fetch PR data first and checkout the head ref (see qa.yml lines 27-40 for a complete pattern).

Suggested change
steps:
- name: Checkout repository
uses: actions/checkout@v4
steps:
- name: Get PR branch
id: pr
uses: actions/github-script@v7
with:
script: |
const pr = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
});
core.setOutput('head_ref', pr.data.head.ref);
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ steps.pr.outputs.head_ref }}
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0

Copilot uses AI. Check for mistakes.
@sonarqubecloud
Copy link

theshadowco pushed a commit that referenced this pull request Nov 21, 2025
Add GitHub Actions workflow to build bootJar on comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants