Skip to content

feat: add custom property value sync#72

Open
joshjohanning wants to merge 3 commits into
mainfrom
joshjohanning/custom-property-values-plan
Open

feat: add custom property value sync#72
joshjohanning wants to merge 3 commits into
mainfrom
joshjohanning/custom-property-values-plan

Conversation

@joshjohanning
Copy link
Copy Markdown
Owner

Summary

  • add custom-property-values-file and per-org custom-property-values support for repository custom property values
  • support repo selection by bare names, names-file, and GitHub repository query
  • validate schema/repositories, warn on missing selected repos/conflicts, diff before patching, and batch updates by 30 repos
  • document selector behavior, CODEOWNERS caveat, samples, and bump version to 1.13.0

Validation

  • npm run all

Fixes #51

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 20, 2026 22:05
Copy link
Copy Markdown
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 extends the action’s custom properties support from syncing org-level schema to also syncing repo-level custom property values across selected repositories within each organization (issue #51).

Changes:

  • Adds custom-property-values-file (plus per-org custom-property-values / custom-property-values-file overrides) and implements repository selection via names, names-file, and query.
  • Implements value syncing with schema validation, selection/conflict warnings, diff logging, and batched updates (30 repos/request).
  • Updates docs, samples, tests, and bumps version to 1.13.0.
Show a summary per file
File Description
src/index.js Adds parsing/normalization for custom property value rules and implements syncCustomPropertyValues() execution in run().
action.yml Introduces the new custom-property-values-file action input.
README.md Documents custom property values syncing, selectors, precedence/override rules, and updates inputs list/permissions notes.
__tests__/index.test.js Adds unit tests for values parsing/normalization and syncing behavior (diffing, conflicts, dry-run).
sample-configuration/custom-property-values.yml Adds an example custom property values rules file.
sample-configuration/orgs.yml Demonstrates per-org inline and file-based custom property values configuration.
sample-configuration/teams/platform-repos.yml Adds a sample repo list file for names-file selectors.
package.json Bumps version to 1.13.0.
package-lock.json Updates lockfile version metadata to 1.13.0.
badges/coverage.svg Updates the generated coverage badge.

Copilot's findings

  • Files reviewed: 8/10 changed files
  • Comments generated: 4

Comment thread src/index.js
Comment thread src/index.js Outdated
Comment thread src/index.js Outdated
Comment thread src/index.js
@joshjohanning joshjohanning changed the title Add custom property value sync feat: add custom property value sync May 21, 2026
- Preserve boolean values in normalizeCustomPropertyValue so true_false
  custom properties are not coerced to strings before API writes
- Remove redundant GET /orgs/{org}/repos call; build repoNameMap from
  currentEntries which already contains all org repositories
- Add true_false type validation in validateCustomPropertyValueRuleAgainstSchema
  so non-boolean values (e.g. strings) are caught before hitting the API
- Update 'at least one setting' error message to mention both
  organizations-file and custom-property-values-file config paths
- Add tests for boolean value preservation and true_false schema validation

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
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.

Copilot's findings

  • Files reviewed: 8/10 changed files
  • Comments generated: 1

Comment thread README.md
- Fix 1: fall back to GET /repos/{org}/{name} when a hard-selected repo
  is not in the /properties/values response, avoiding false 'not found'
  warnings for repos that have never had any property values set
- Fix 2: merge desired custom-properties schema into schemaMap in dry-run
  mode so newly-defined properties don't cause false unknown-property
  validation failures when schema and values are introduced together
- Fix 3: treat null/undefined and [] as equal in customPropertyValuesEqual
  to prevent infinite re-patching when the API returns null for an empty
  multi_select instead of []
- Fix 4: conflict warning now names both rule numbers and their values
  to make debugging multi-rule conflicts easier
- Fix 5: cache /properties/values query results per-run so repeated rules
  sharing the same query string don't re-paginate the whole org
- Bonus: aggregate all schema validation errors per rule before throwing
  instead of stopping at the first invalid property
- Bonus: sort multi_select array values in batch grouping key so repos
  with semantically identical values group into the same PATCH call

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
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.

Copilot's findings

  • Files reviewed: 8/10 changed files
  • Comments generated: 3

Comment thread src/index.js
Comment on lines +362 to +370
if (Array.isArray(orgConfig['custom-property-values'])) {
for (const [index, rule] of orgConfig['custom-property-values'].entries()) {
if (typeof rule !== 'object' || rule === null) continue;
for (const key of Object.keys(rule)) {
if (!KNOWN_CUSTOM_PROPERTY_VALUE_RULE_KEYS.has(key)) {
core.warning(
`⚠️ Unknown custom property value rule key "${key}" found for rule ${index + 1} in organization "${orgName}". ` +
`This key may not exist or may have a typo.`
);
Comment thread src/index.js
}

const repoNameMap = new Map(
currentEntries.map(entry => [entry.repository_name.toLowerCase(), entry.repository_name])
Comment thread src/index.js
Comment on lines +4063 to +4083
if (schema.value_type === 'multi_select') {
if (!Array.isArray(property.value)) {
errors.push(`Custom property value ${context} property "${property.property_name}" must be an array`);
} else {
const err = getCustomPropertyAllowedValuesError(property, schema, context);
if (err) errors.push(err);
}
} else if (schema.value_type === 'true_false') {
if (typeof property.value !== 'boolean') {
errors.push(
`Custom property value ${context} property "${property.property_name}" must be a boolean (true or false)`
);
}
} else {
if (Array.isArray(property.value)) {
errors.push(`Custom property value ${context} property "${property.property_name}" must not be an array`);
} else {
const err = getCustomPropertyAllowedValuesError(property, schema, context);
if (err) errors.push(err);
}
}
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.

feat: sync custom property values on organization repositories

2 participants