Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions .github/actions/core-cicd/deployment/deploy-docker/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ runs:
if: (inputs.docker_registry == 'GHCR.IO' || inputs.docker_registry == 'BOTH') && inputs.do_deploy == 'true'

- name: Set up QEMU
uses: docker/setup-qemu-action@v3.0.0
uses: docker/setup-qemu-action@v3.6.0
with:
image: tonistiigi/binfmt:qemu-v7.0.0-28
platforms: ${{ inputs.docker_platforms }}
Expand Down Expand Up @@ -174,14 +174,12 @@ runs:
if: success()

- name: Docker Setup Buildx
uses: docker/setup-buildx-action@v3.0.0
uses: docker/setup-buildx-action@v3.10.0
with:
version: latest
version: v0.20.0 # version of buildx https://github.com/docker/buildx/releases
platforms: ${{ inputs.docker_platforms }}
driver-opts: |
image=moby/buildkit:v0.12.2
- name: Build/Push Docker Image
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6.15.0
with:
context: ${{ steps.setup-context.outputs.docker_context }}
tags: ${{ steps.meta.outputs.tags }}
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/cicd_manual_build-docker-context.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,24 @@ jobs:

echo "PLATFORMS=${PLATFORMS}" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v3.0.0
uses: docker/setup-qemu-action@v3.6.0
with:
platforms: amd64,arm64
if: github.event.inputs.multi_arch == 'true'
- id: docker-setup-buildx
name: Docker Setup Buildx
uses: docker/setup-buildx-action@v3.0.0
uses: docker/setup-buildx-action@v3.10.0
with:
version: v0.20.0 # version of buildx https://github.com/docker/buildx/releases
platforms: ${{ env.PLATFORMS }}
driver-opts: |
image=moby/buildkit:v0.12.2
if: github.event.inputs.multi_arch == 'true'
- name: Docker Hub login
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5.0.0
uses: docker/build-push-action@v6.15.0
with:
context: ./docker/${{ github.event.inputs.context }}
push: ${{ github.event.inputs.push }}
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/cicd_manual_build-java-base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,24 @@ jobs:

echo "PLATFORMS=${PLATFORMS}" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v3.0.0
uses: docker/setup-qemu-action@v3.6.0
with:
platforms: amd64,arm64
if: github.event.inputs.multi_arch == 'true'
- id: docker-setup-buildx
name: Docker Setup Buildx
uses: docker/setup-buildx-action@v3.0.0
uses: docker/setup-buildx-action@v3.10.0
with:
version: v0.20.0 # version of buildx https://github.com/docker/buildx/releases
platforms: ${{ env.PLATFORMS }}
driver-opts: |
image=moby/buildkit:v0.12.2
if: github.event.inputs.multi_arch == 'true'
- name: Docker Hub login
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5.0.0
uses: docker/build-push-action@v6.15.0
with:
context: ./docker/java-base
push: ${{ github.event.inputs.push }}
Expand Down
224 changes: 163 additions & 61 deletions .github/workflows/issue_comp_link-issue-to-pr.yml
Original file line number Diff line number Diff line change
@@ -1,113 +1,215 @@
name: Link Issue to PR
name: Link issue to PR

on:
workflow_call:
inputs:
pr_branch:
description: 'Pull Request branch'
type: string
description: 'PR branch name'
required: true
type: string
pr_url:
description: 'Pull Request URL'
description: 'PR URL'
required: true
type: string
pr_title:
description: 'PR title'
required: true
secrets:
CI_MACHINE_TOKEN:
description: 'CI machine token'
type: string
pr_body:
description: 'PR body'
required: true

workflow_dispatch:
inputs:
pr_branch:
description: 'Pull Request branch'
type: string
pr_author:
description: 'PR author'
required: true
pr_url:
description: 'Pull Request URL'
type: string
pr_merged:
description: 'PR merged status'
required: true

env:
GH_TOKEN: ${{ secrets.CI_MACHINE_TOKEN }}

type: string
jobs:
add-issue-to-pr:
runs-on: ubuntu-${{ vars.UBUNTU_RUNNER_VERSION || '24.04' }}

link-issue:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ github.token }}

steps:
- run: echo 'GitHub context'
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Debug workflow inputs
run: |
echo "PR Branch: ${{ inputs.pr_branch }}"
echo "PR URL: ${{ inputs.pr_url }}"
echo "PR Title: ${{ inputs.pr_title }}"
echo "PR Body: ${{ inputs.pr_body }}"
echo "PR Author: ${{ inputs.pr_author }}"
echo "PR Merged: ${{ inputs.pr_merged }}"
env:
GITHUB_CONTEXT: ${{ toJson(github) }}

- name: Check if PR already has linked issues
id: check_existing_issues
run: |
pr_url="${{ inputs.pr_url }}"
pr_number=$(echo "$pr_url" | grep -o '[0-9]*$')

# Get PR details
pr_details=$(curl -s \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ env.GH_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/${{ github.repository }}/pulls/$pr_number")

# Check for issues linked via GitHub's Development section (timeline events)
timeline_events=$(curl -s \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ env.GH_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/${{ github.repository }}/issues/$pr_number/timeline")

# Look for connected/disconnected events that indicate manual linking
connected_issue=$(echo "$timeline_events" | jq -r '.[] | select(.event == "connected") | .source.issue.number' | head -1)

if [[ -n "$connected_issue" && "$connected_issue" != "null" ]]; then
echo "Found manually linked issue via Development section: $connected_issue"
echo "has_linked_issues=true" >> "$GITHUB_OUTPUT"
echo "linked_issue_number=$connected_issue" >> "$GITHUB_OUTPUT"
echo "link_method=development_section" >> "$GITHUB_OUTPUT"
else
# Check if PR body contains issue references (fixes #123, closes #456, etc.)
pr_body=$(echo "$pr_details" | jq -r '.body // ""')

# Extract issue numbers from PR body using various keywords
linked_issues=$(echo "$pr_body" | grep -oiE '(fixes?|closes?|resolves?)\s+#([0-9]+)' | grep -oE '[0-9]+' | head -1)

if [[ -n "$linked_issues" ]]; then
echo "Found linked issue in PR body: $linked_issues"
echo "has_linked_issues=true" >> "$GITHUB_OUTPUT"
echo "linked_issue_number=$linked_issues" >> "$GITHUB_OUTPUT"
echo "link_method=pr_body" >> "$GITHUB_OUTPUT"
else
echo "No linked issues found in Development section or PR body"
echo "has_linked_issues=false" >> "$GITHUB_OUTPUT"
fi
fi

- name: Extract issue number from branch name
id: extract_issue_number
run: |
branch_name="${{ inputs.pr_branch }}"
issue_number=""

# Try multiple patterns to extract issue number (more flexible but specific)
if [[ "$branch_name" =~ ^([0-9]+)- ]]; then
issue_number="${BASH_REMATCH[1]}"
echo "Found issue number at start of branch: $issue_number"
elif [[ "$branch_name" =~ ^issue-([0-9]+)- ]]; then
issue_number="${BASH_REMATCH[1]}"
echo "Found issue number with 'issue-' prefix: $issue_number"
elif [[ "$branch_name" =~ issue-([0-9]+) ]]; then
issue_number="${BASH_REMATCH[1]}"
echo "Found issue number with 'issue-' anywhere in branch: $issue_number"
else
echo "Branch name doesn't match the expected pattern"
exit 1
echo "No issue number found in branch name: $branch_name"
fi

echo "issue_number=$issue_number" >> "$GITHUB_OUTPUT"

- name: Determine final issue number
id: determine_issue
run: |
# Priority: 1) Manually linked issues (Development section or PR body), 2) Branch name extraction
if [[ "${{ steps.check_existing_issues.outputs.has_linked_issues }}" == "true" ]]; then
final_issue_number="${{ steps.check_existing_issues.outputs.linked_issue_number }}"
link_method="${{ steps.check_existing_issues.outputs.link_method }}"
echo "Using manually linked issue: $final_issue_number (via $link_method)"
elif [[ -n "${{ steps.extract_issue_number.outputs.issue_number }}" ]]; then
final_issue_number="${{ steps.extract_issue_number.outputs.issue_number }}"
echo "Using issue from branch name: $final_issue_number"
else
echo "::error::No issue number found in Development section, PR body, or branch name"
echo "::error::Please link an issue using one of these methods:"
echo "::error::1. Link via GitHub UI: Go to PR → Development section → Link issue"
echo "::error::2. Add 'fixes #123' (or closes/resolves) to PR body, or"
echo "::error::3. Use branch naming like 'issue-123-feature' or '123-feature'"
exit 1
fi

echo "final_issue_number=$final_issue_number" >> "$GITHUB_OUTPUT"

- name: Get existing issue comments
id: get_comments
run: |
comments="$(\
curl -s \
comments=$(curl -s \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ env.GH_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ steps.extract_issue_number.outputs.issue_number }}/comments \
| jq -c .
)"
https://api.github.com/repos/${{ github.repository }}/issues/${{ steps.determine_issue.outputs.final_issue_number }}/comments \
| jq -c .)

echo "comments=${comments}" >> "$GITHUB_OUTPUT"
echo "comments=$comments" >> "$GITHUB_OUTPUT"

- name: Check if PR comment exists
- name: Check if comment already exists
id: check_comment
uses: actions/github-script@v7
with:
script: |
const prUrl = '${{ inputs.pr_url }}';
let prList = `PRs:\n- ${prUrl}`;
let existingCommentId = '';
const comments = JSON.parse(${{ toJSON(steps.get_comments.outputs.comments) }});
run: |
comments='${{ steps.get_comments.outputs.comments }}'
pr_url="${{ inputs.pr_url }}"

# Check if our bot comment already exists
existing_comment=$(echo "$comments" | jq -r '.[] | select(.user.login == "github-actions[bot]" and (.body | contains("PRs linked to this issue"))) | .id' | head -1)

if [[ -n "$existing_comment" && "$existing_comment" != "null" ]]; then
echo "Found existing comment: $existing_comment"
echo "existing_comment_id=$existing_comment" >> "$GITHUB_OUTPUT"
else
echo "No existing comment found"
echo "existing_comment_id=" >> "$GITHUB_OUTPUT"
fi

# Get existing PR list from the comment if it exists
if [[ -n "$existing_comment" && "$existing_comment" != "null" ]]; then
existing_body=$(echo "$comments" | jq -r --arg id "$existing_comment" '.[] | select(.id == ($id | tonumber)) | .body')
pr_list=$(echo "$existing_body" | grep -o "- \[.*\](.*).*" | sort -u)

for(comment of comments) {
const commentBody = comment.body;
if (commentBody.startsWith('PRs:')) {
existingCommentId = comment.id;
prList = `${commentBody}\n- ${prUrl}`;
break;
}
}
# Check if current PR is already in the list
if echo "$pr_list" | grep -q "$pr_url"; then
echo "PR already exists in comment, using existing list"
echo "pr_list=$existing_body" >> "$GITHUB_OUTPUT"
else
# Add new PR to the list
new_pr_line="- [${{ inputs.pr_title }}](${{ inputs.pr_url }}) by @${{ inputs.pr_author }}"
if [[ "${{ inputs.pr_merged }}" == "true" ]]; then
new_pr_line="$new_pr_line ✅"
fi

updated_list=$(echo -e "$pr_list\n$new_pr_line" | sort -u)
new_body="## PRs linked to this issue\n\n$updated_list"
echo "pr_list=$new_body" >> "$GITHUB_OUTPUT"
fi
else
# Create new PR list
new_pr_line="- [${{ inputs.pr_title }}](${{ inputs.pr_url }}) by @${{ inputs.pr_author }}"
if [[ "${{ inputs.pr_merged }}" == "true" ]]; then
new_pr_line="$new_pr_line ✅"
fi

core.setOutput('pr_list', prList);
core.setOutput('existing_comment_id', existingCommentId);
console.log(`pr_list: [${prList}]`);
console.log(`existing_comment_id: [${existingCommentId}]`);
new_body="## PRs linked to this issue\n\n$new_pr_line"
echo "pr_list=$new_body" >> "$GITHUB_OUTPUT"
fi

- name: Update or create comment
- name: Create new comment
if: steps.check_comment.outputs.existing_comment_id == ''
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ steps.extract_issue_number.outputs.issue_number }}
issue-number: ${{ steps.determine_issue.outputs.final_issue_number }}
body: ${{ steps.check_comment.outputs.pr_list }}

- name: Update existing comment
if: steps.check_comment.outputs.existing_comment_id != ''
uses: actions/github-script@v7
uses: peter-evans/create-or-update-comment@v4
with:
script: |
const prs = ${{ toJSON(steps.check_comment.outputs.pr_list) }}.split('\n');
await github.rest.issues.updateComment({
owner: '${{ github.repository_owner }}',
repo: '${{ github.event.repository.name }}',
comment_id: ${{ steps.check_comment.outputs.existing_comment_id }},
body: prs.join('\n')
});
comment-id: ${{ steps.check_comment.outputs.existing_comment_id }}
body: ${{ steps.check_comment.outputs.pr_list }}
6 changes: 4 additions & 2 deletions .github/workflows/issue_open-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ jobs:
with:
pr_branch: ${{ github.head_ref }}
pr_url: ${{ github.event.pull_request.html_url }}
secrets:
CI_MACHINE_TOKEN: ${{ secrets.CI_MACHINE_TOKEN }}
pr_title: ${{ github.event.pull_request.title }}
pr_body: ${{ github.event.pull_request.body }}
pr_author: ${{ github.event.pull_request.user.login }}
pr_merged: ${{ github.event.pull_request.merged }}
Loading