Skip to content

Commit

Permalink
resync
Browse files Browse the repository at this point in the history
  • Loading branch information
sc979 committed Nov 19, 2024
1 parent 755e7eb commit 32cd191
Show file tree
Hide file tree
Showing 2,963 changed files with 107,027 additions and 68,687 deletions.
4 changes: 3 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
*.md @centreon/owners-doc
*.mdx @centreon/owners-doc

**/www/widgets/ @centreon/owners-react

**/config/ @centreon/owners-php
**/composer.* @centreon/owners-php
**/tests/api/ @centreon/owners-php
Expand All @@ -18,7 +20,6 @@
*.xsl @centreon/owners-php

**/www/front_src/ @centreon/owners-react
**/www/widgets/ @centreon/owners-react
**/cypress/** @centreon/owners-react
centreon/cypress @centreon/owners-react
package.json @centreon/owners-react
Expand Down Expand Up @@ -51,6 +52,7 @@ tsconfig.json @centreon/owners-react
**/packaging/ @centreon/owners-pipelines
dependencies/** @centreon/owners-pipelines
.coderabbit.yml @centreon/owners-pipelines
**/unattended.sh @centreon/owners-pipelines

**/config/features.json @centreon/release-management

Expand Down
30 changes: 0 additions & 30 deletions .github/actions/backend-dependencies/action.yml

This file was deleted.

43 changes: 43 additions & 0 deletions .github/actions/changes-trigger-checks/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: changes-trigger-checks
description: Trigger checks based on changes
inputs:
has_frontend_changes:
description: Whether the PR contains changes on the frontend
required: true
has_backend_changes:
description: Whether the PR contains changes on the backend
required: true
has_test_changes:
description: Whether the PR contains changes on the test suite
required: true

outputs:
trigger_delivery:
description: Validation of the package delivery
value: ${{ steps.trigger_delivery.outputs.trigger_delivery }}
trigger_api_testing:
description: Validation of the API testing
value: ${{ steps.trigger_api_testing.outputs.trigger_api_testing }}

runs:
using: "composite"
steps:
- name: Validate package delivery trigger
id: trigger_delivery
run: |
TRIGGER_DELIVERY=false
if [[ ${{ inputs.has_frontend_changes }} == 'true' || ${{ inputs.has_backend_changes }} == 'true' ]]; then
TRIGGER_DELIVERY=true
fi
echo "trigger_delivery=$TRIGGER_DELIVERY" >> $GITHUB_OUTPUT
shell: bash

- name: Validate API testing trigger
id: trigger_api_testing
run: |
TRIGGER_API_TESTING=false
if [[ ${{ inputs.has_backend_changes }} == 'true' || ${{ inputs.has_test_changes }} == 'true' ]]; then
TRIGGER_API_TESTING=true
fi
echo "trigger_api_testing=$TRIGGER_API_TESTING" >> $GITHUB_OUTPUT
shell: bash
2 changes: 1 addition & 1 deletion .github/actions/chromatic/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ runs:
version: 8
run_install: false

- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
- uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
with:
node-version: 20
cache: pnpm
Expand Down
23 changes: 0 additions & 23 deletions .github/actions/clean-up-npm-tag/action.yml

This file was deleted.

11 changes: 11 additions & 0 deletions .github/actions/clean-up-npm-tags/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: "Clean up NPM versions"
description: "Cleans up NPM pre-release versions for a package"

inputs:
npm_token:
description: The NPM token to use for publication
required: true

runs:
using: 'node20'
main: 'index.js'
60 changes: 60 additions & 0 deletions .github/actions/clean-up-npm-tags/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { execSync } from 'child_process';
import core from '@actions/core';

const packages = ['js-config', 'ui-context', 'ui'];

const getPackageInformations = async (dependency) => {
const response = await fetch(
`https://registry.npmjs.org/@centreon/${dependency}`
);
return await response.json();
};

const checkAndCleanUpTag = async ({ dependency, branch }) => {
core.info(`${dependency}: Retrieving branch for ${branch}...`);
const d = await fetch(`https://github.com/centreon/centreon/tree/${branch}`);

if (d.status !== 404 || branch === 'latest') {
core.info(`${dependency}: ${branch} branch found on Github. Skipping it.`);
return;
}

core.info(
`${dependency}: ${branch} branch not found on Github. Cleaning up the NPM tag...`
);

execSync(`npm dist-tag rm @centreon/${dependency} ${branch}`);
core.info(`${dependency}: ${branch} tag removed.`);
return;
};

const run = async () => {
core.info('Logging in to NPM registry...');
execSync(
`npm config set "//registry.npmjs.org/:_authToken" "${core.getInput('npm_token')}"`
);
core.info('Logged in');

await Promise.all(
packages.map(async (dependency) => {
const packageInformations = await getPackageInformations(dependency);
core.debug(`Processing tags for ${dependency}...`);

const distTags = packageInformations['dist-tags'];

const branchNamesFromTags = Object.keys(distTags);

let chainedPromise = Promise.resolve();
branchNamesFromTags.forEach((branch) => {
chainedPromise = chainedPromise.then(() => {
return checkAndCleanUpTag({ dependency, branch });
});
});
core.debug(`${dependency} tags processed...`);
})
);
};

run().finally(() => {
execSync('npm config delete "//registry.npmjs.org/:_authToken"');
});
14 changes: 14 additions & 0 deletions .github/actions/clean-up-npm-tags/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "clean-up-npm-tags",
"version": "1.0.0",
"description": "This module will clean up unused NPM tags.",
"main": "index.js",
"scripts": {},
"keywords": [],
"author": "centreon",
"type": "module",
"dependencies": {
"@actions/core": "^1.10.0",
"node-fetch": "2"
}
}
65 changes: 65 additions & 0 deletions .github/actions/clean-up-npm-tags/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 32cd191

Please sign in to comment.