-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2,963 changed files
with
107,027 additions
and
68,687 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.