Skip to content

Commit 443caf4

Browse files
committed
fix copilot findings
1 parent 8743a0d commit 443caf4

5 files changed

Lines changed: 42 additions & 41 deletions

File tree

.github/workflows/reusable_integration-build.yml

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,18 @@
1919
# single label string (e.g., ubuntu-latest) or a JSON string representing a
2020
# label or an array of labels (e.g., "\"ubuntu-latest\"" or
2121
# "[\"self-hosted\",\"linux\",\"x64\"]").
22-
# - ref_int_repo (string, optional, default: eclipse-score/reference_integration):
23-
# Reference Integration repository to checkout.
24-
# - ref_int_ref (string, optional, default: main): Ref/branch to checkout.
22+
# - target_branch (string, optional, default: main): Ref/branch to checkout.
23+
#
24+
# Repository Variables:
25+
# - reference_integration_repo (optional): Repository to checkout (owner/repo).
26+
# Default: eclipse-score/reference_integration
27+
#
28+
# Secrets:
2529
# - REPO_READ_TOKEN (secret, optional): Token for private module access; falls
2630
# back to github.token when not provided.
2731
#
2832
# Runner selection:
29-
# - Priority: `inputs.repo_runner_labels` > `vars.REPO_RUNNER_LABELS` > 'ubuntu-latest'.
33+
# - Priority: `inputs.repo_runner_labels` > 'ubuntu-latest'.
3034
# - `repo_runner_labels` can be provided as a single label string or as JSON
3135
# (string or array). When JSON is used, it is parsed via fromJSON().
3236
#
@@ -40,7 +44,7 @@
4044
# known_good: |
4145
# { "modules": [] }
4246
# config: bl-x86_64-linux
43-
# repo_runner_labels: '"ubuntu-latest"'
47+
# repo_runner_labels: 'ubuntu-latest'
4448
# secrets:
4549
# REPO_READ_TOKEN: ${{ secrets.REPO_READ_TOKEN }}
4650
#
@@ -66,21 +70,19 @@ on:
6670
description: 'Runner label(s) for the job; single label or JSON string/array.'
6771
required: false
6872
type: string
69-
ref_int_ref:
73+
target_branch:
7074
description: 'Reference Integration repository ref to checkout.'
7175
required: false
7276
type: string
7377
default: 'main'
74-
ref_int_repo:
75-
description: 'Reference Integration repository repo to checkout.'
76-
required: false
77-
type: string
78-
default: 'eclipse-score/reference_integration'
78+
79+
env:
80+
REFERENCE_INTEGRATION_REPO: ${{ vars.reference_integration_repo != '' && vars.reference_integration_repo || 'eclipse-score/reference_integration' }}
7981

8082
jobs:
8183
integration-test:
8284
name: Integration Test
83-
runs-on: ${{ (inputs.repo_runner_labels && startsWith(inputs.repo_runner_labels, '[') && fromJSON(inputs.repo_runner_labels)) || inputs.repo_runner_labels || (vars.REPO_RUNNER_LABELS && fromJSON(vars.REPO_RUNNER_LABELS)) || 'ubuntu-latest' }}
85+
runs-on: ${{ inputs.repo_runner_labels != '' && (startsWith(inputs.repo_runner_labels, '[') && fromJSON(inputs.repo_runner_labels) || inputs.repo_runner_labels) || 'ubuntu-latest' }}
8486
steps:
8587
- name: Show disk space before build
8688
run: |
@@ -102,8 +104,8 @@ jobs:
102104
- name: Checkout repository
103105
uses: actions/checkout@v4.2.2
104106
with:
105-
repository: ${{ inputs.ref_int_repo || 'eclipse-score/reference_integration' }}
106-
ref: ${{ inputs.ref_int_ref || 'main' }}
107+
repository: ${{ env.REFERENCE_INTEGRATION_REPO }}
108+
ref: ${{ inputs.target_branch || 'main' }}
107109
token: ${{ secrets.REPO_READ_TOKEN != '' && secrets.REPO_READ_TOKEN || github.token }}
108110
- name: Setup Bazel
109111
uses: bazel-contrib/setup-bazel@0.15.0

.github/workflows/reusable_smoke-test.yml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,15 @@
1717
# Inputs:
1818
# - repo_runner_labels (string, required, default: ubuntu-latest): Runner label.
1919
# - module_name (string, required): Module to override (e.g., score_baselibs).
20-
# - ref_int_repo (string, optional, default: eclipse-score/reference_integration):
21-
# The repository that provides the reusable integration workflows and tools.
22-
# Use your private fork/org if you mirror this repo (e.g., my-org/reference_integration).
23-
# Format: owner/repo
24-
# - ref_int_ref (string, required, default: main):
25-
# The ref on ref_int_repo to checkout via actions/checkout — can be a branch
26-
# name, tag, or commit SHA. This ensures the workflow uses the exact version
27-
# of the integration files you intend.
20+
# - target_branch (string, required, default: main):
21+
# The ref to checkout via actions/checkout — can be a branch name, tag, or
22+
# commit SHA. This ensures the workflow uses the exact version of the
23+
# integration files you intend.
24+
#
25+
# Repository Variables:
26+
# - reference_integration_repo (optional): Repository providing integration
27+
# workflows and tools (format: owner/repo). Supports private forks.
28+
# Default: eclipse-score/reference_integration
2829
#
2930
# Secrets:
3031
# - REPO_READ_TOKEN (optional): Token for reading private repos; falls back to
@@ -39,11 +40,13 @@
3940
# with:
4041
# repo_runner_labels: ubuntu-latest
4142
# module_name: score_baselibs
42-
# ref_int_ref: main
43-
# ref_int_repo: eclipse-score/reference_integration
43+
# target_branch: main
4444
# secrets:
4545
# REPO_READ_TOKEN: ${{ secrets.REPO_READ_TOKEN }}
4646
#
47+
# Note: Set the 'reference_integration_repo' repository variable to use a
48+
# private fork (e.g., my-org/reference_integration).
49+
#
4750
# Notes:
4851
# - Extend the matrix in `integration-test` to cover additional configs.
4952

@@ -61,21 +64,19 @@ on:
6164
description: 'Name of the module to override (e.g., score_baselibs).'
6265
required: true
6366
type: string
64-
ref_int_ref:
65-
description: 'Ref on ref_int_repo to checkout (branch, tag, or commit SHA).'
67+
target_branch:
68+
description: 'Ref to checkout (branch, tag, or commit SHA).'
6669
required: true
6770
type: string
6871
default: 'main'
69-
ref_int_repo:
70-
description: 'Repository providing integration workflows (owner/repo). Supports private forks.'
71-
required: false
72-
type: string
73-
default: 'eclipse-score/reference_integration'
7472
secrets:
7573
REPO_READ_TOKEN:
7674
description: 'Token for reading repositories'
7775
required: false
7876

77+
env:
78+
REFERENCE_INTEGRATION_REPO: ${{ vars.reference_integration_repo != '' && vars.reference_integration_repo || 'eclipse-score/reference_integration' }}
79+
7980
jobs:
8081
preparation:
8182
name: Preparation
@@ -86,13 +87,13 @@ jobs:
8687
- name: Checkout repository
8788
uses: actions/checkout@v4.2.2
8889
with:
89-
repository: ${{ inputs.ref_int_repo }}
90-
ref: ${{ inputs.ref_int_ref }}
90+
repository: ${{ env.REFERENCE_INTEGRATION_REPO }}
91+
ref: ${{ inputs.target_branch }}
9192
token: ${{ secrets.REPO_READ_TOKEN != '' && secrets.REPO_READ_TOKEN || github.token }}
9293
- name: Create updated known_good.json with PR commit
9394
id: set_known_good
9495
run: |
95-
if [ "${{ github.repository }}" != "${{ inputs.ref_int_repo }}" ]; then
96+
if [ "${{ github.repository }}" != "${{ env.REFERENCE_INTEGRATION_REPO }}" ]; then
9697
echo "Overriding ${{ inputs.module_name }} with current PR"
9798
python3 tools/override_known_good_repo.py \
9899
--known known_good.json \
@@ -148,8 +149,7 @@ jobs:
148149
known_good: ${{ needs.preparation.outputs.known_good_updated }}
149150
config: ${{ matrix.config }}
150151
repo_runner_labels: ${{ inputs.repo_runner_labels }}
151-
ref_int_ref: ${{ inputs.ref_int_ref }}
152-
ref_int_repo: ${{ inputs.ref_int_repo }}
152+
target_branch: ${{ inputs.target_branch }}
153153

154154
summary:
155155
name: Publish Summary

.github/workflows/test_integration.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,4 @@ jobs:
2828
with:
2929
repo_runner_labels: 'ubuntu-latest'
3030
module_name: 'reference_integration'
31-
ref_int_ref: ${{ github.ref }}
32-
ref_int_repo: ${{ github.repository }}
31+
target_branch: ${{ github.ref }}

tools/override_known_good_repo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import json
1717
import os
1818
import re
19-
from datetime import datetime
19+
import datetime as dt
2020
from typing import Dict, Any, List
2121
import logging
2222

@@ -159,7 +159,7 @@ def apply_overrides(data: Dict[str, Any], repo_overrides: List[str]) -> Dict[str
159159
data["modules"] = {name: module.to_dict() for name, module in modules.items()}
160160

161161
# Update timestamp
162-
data["timestamp"] = datetime.now().isoformat() + "Z"
162+
data["timestamp"] = dt.datetime.now(dt.timezone.utc).replace(microsecond=0).isoformat() + "Z"
163163

164164
return data
165165

tools/update_module_from_known_good.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def generate_git_override_blocks(modules: List[Module], repo_commit_dict: Dict[s
5959
patches_lines += f' "{patch}",\n'
6060
patches_lines += " ],\n patch_strip = 1,\n"
6161

62-
if module.version and not commit:
62+
if module.version:
6363
# If version is provided, use bazel_dep with single_version_override
6464
block = (
6565
f'bazel_dep(name = "{module.name}")\n'

0 commit comments

Comments
 (0)