diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.yml index 8eb3a32239..140232ed51 100644 --- a/.github/workflows/actionlint.yml +++ b/.github/workflows/actionlint.yml @@ -6,7 +6,7 @@ concurrency: on: workflow_dispatch: - pull_request_target: + pull_request: branches: - develop - dev-[2-9][0-9].[0-9][0-9].x diff --git a/.github/workflows/awie.yml b/.github/workflows/awie.yml index 534cefd80e..87fe8d3df0 100644 --- a/.github/workflows/awie.yml +++ b/.github/workflows/awie.yml @@ -6,7 +6,7 @@ concurrency: on: workflow_dispatch: - pull_request_target: + pull_request: types: - opened - synchronize diff --git a/.github/workflows/check-status.yml b/.github/workflows/check-status.yml index da1b20ef31..6cfbf4f788 100644 --- a/.github/workflows/check-status.yml +++ b/.github/workflows/check-status.yml @@ -18,11 +18,6 @@ jobs: check-status: runs-on: ubuntu-24.04 steps: - - name: Dump GitHub context - env: - GITHUB_CONTEXT: ${{ toJson(github) }} - run: echo "$GITHUB_CONTEXT" - - name: Check workflow statuses and display token usage env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/clean-cache.yml b/.github/workflows/clean-cache.yml index 124fad1244..1bf7ccf7e6 100644 --- a/.github/workflows/clean-cache.yml +++ b/.github/workflows/clean-cache.yml @@ -1,7 +1,7 @@ name: clean-cache on: - pull_request_target: + pull_request: types: - closed diff --git a/.github/workflows/create-repo-yum.yml b/.github/workflows/create-repo-yum.yml index 8a0b38a821..6ea0dacd8e 100644 --- a/.github/workflows/create-repo-yum.yml +++ b/.github/workflows/create-repo-yum.yml @@ -6,7 +6,7 @@ concurrency: on: workflow_dispatch: - pull_request_target: + pull_request: paths: - ".github/workflows/create-repo-yum.yml" diff --git a/.github/workflows/docker-keycloak.yml b/.github/workflows/docker-keycloak.yml index 446ed81f4d..14cc7f033d 100644 --- a/.github/workflows/docker-keycloak.yml +++ b/.github/workflows/docker-keycloak.yml @@ -6,7 +6,7 @@ concurrency: on: workflow_dispatch: - pull_request_target: + pull_request: paths: - ".github/docker/keycloak/**" push: diff --git a/.github/workflows/docker-packaging.yml b/.github/workflows/docker-packaging.yml index c61cd5e792..3b4dde61b7 100644 --- a/.github/workflows/docker-packaging.yml +++ b/.github/workflows/docker-packaging.yml @@ -12,7 +12,7 @@ on: - dev-[2-9][0-9].[0-9][0-9].x paths: - ".github/docker/Dockerfile.packaging-*" - pull_request_target: + pull_request: paths: - ".github/docker/Dockerfile.packaging-*" diff --git a/.github/workflows/docker-translation.yml b/.github/workflows/docker-translation.yml index 5fee99a740..a9c695e62f 100644 --- a/.github/workflows/docker-translation.yml +++ b/.github/workflows/docker-translation.yml @@ -12,7 +12,7 @@ on: - dev-[2-9][0-9].[0-9][0-9].x paths: - ".github/docker/Dockerfile.translation" - pull_request_target: + pull_request: paths: - ".github/docker/Dockerfile.translation" diff --git a/.github/workflows/docker-web-dependencies.yml b/.github/workflows/docker-web-dependencies.yml index 51decd730d..8b55dc48a9 100644 --- a/.github/workflows/docker-web-dependencies.yml +++ b/.github/workflows/docker-web-dependencies.yml @@ -6,7 +6,7 @@ concurrency: on: workflow_dispatch: - pull_request_target: + pull_request: paths: - '.github/docker/centreon-web/**/Dockerfile.dependencies' schedule: diff --git a/.github/workflows/dsm.yml b/.github/workflows/dsm.yml index a43862db8b..cb0ab8f221 100644 --- a/.github/workflows/dsm.yml +++ b/.github/workflows/dsm.yml @@ -6,7 +6,7 @@ concurrency: on: workflow_dispatch: - pull_request_target: + pull_request: types: - opened - synchronize @@ -31,21 +31,7 @@ env: module: dsm jobs: - validation: - runs-on: ubuntu-22.04 - outputs: - environment_pull_request: ${{ steps.validate.outputs.environment_pull_request }} - steps: - - name: validate - run: | - ENVIRONMENT_PULL_REQUEST="external_contributor" - if [[ "${{ github.author_association }}" != "MEMBER" || "${{ github.author_association }}" != "CONTRIBUTOR" || "${{ github.author_association }}" != "OWNER" ]]; then - ENVIRONMENT_PULL_REQUEST="internal_contributor" - fi - echo "environment_pull_request=$ENVIRONMENT_PULL_REQUEST" >> $GITHUB_OUTPUT - get-version: - environment: ${{ need.validation.outputs.environment_pull_request }} uses: ./.github/workflows/get-version.yml with: version_file: centreon-dsm/www/modules/centreon-dsm/conf.php diff --git a/.github/workflows/get-version.yml b/.github/workflows/get-version.yml index ce3218808b..39315d9ec8 100644 --- a/.github/workflows/get-version.yml +++ b/.github/workflows/get-version.yml @@ -41,14 +41,9 @@ jobs: environment: ${{ steps.get_version.outputs.env }} os_and_database_matrix: ${{ steps.get_os_database_matrix.outputs.result }} release_type: ${{ steps.get_version.outputs.release_type }} - release_cloud: ${{ steps.get_version.outputs.release_cloud }} + release_cloud: ${{ steps.get_version.outputs.release_cloud}} steps: - - name: Dump GitHub context - env: - GITHUB_CONTEXT: ${{ toJson(github) }} - run: echo "$GITHUB_CONTEXT" - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1 @@ -118,16 +113,6 @@ jobs: echo "BRANCHNAME is: $BRANCHNAME" - # Check if pull_request is internal or contribution - IS_EXTERNAL_CONTRIBUTION="" - if [ "${{ github.repository }}" != "${{ github.event.pull_request.head.repo.full_name }}" ]; then - echo "Detected external contribution, setting IS_CONTRIBUTION value to yes." - IS_EXTERNAL_CONTRIBUTION="yes" - else - echo "Detected internal contribution, setting IS_CONTRIBUTION value to no." - IS_EXTERNAL_CONTRIBUTION="no" - fi - # Set default release values GITHUB_RELEASE_CLOUD=0 GITHUB_RELEASE_TYPE=$(echo $BRANCHNAME |cut -d '-' -f 1) @@ -193,33 +178,19 @@ jobs: ;; *) # Any branch name - echo "Github repository context var: $GITHUB_REPOSITORY" - if [[ "$IS_EXTERNAL_CONTRIBUTION" == "no" ]]; then - echo "Internal contribution." - echo "release_cloud=1" >> $GITHUB_OUTPUT - echo "release_type=$GITHUB_RELEASE_TYPE" >> $GITHUB_OUTPUT - # GITHUB_BRANCH_BASE_REF_NAME="$(gh pr view $BRANCHNAME -q .baseRefName --json headRefName,baseRefName,state)" - # GITHUB_BRANCH_PR_STATE="$(gh pr view $BRANCHNAME -q .state --json headRefName,baseRefName,state)" - elif [[ "$IS_EXTERNAL_CONTRIBUTION" == "yes" ]]; then - echo "External contribution." + GITHUB_BRANCH_BASE_REF_NAME="$(gh pr view $BRANCHNAME -q .baseRefName --json headRefName,baseRefName,state)" + GITHUB_BRANCH_PR_STATE="$(gh pr view $BRANCHNAME -q .state --json headRefName,baseRefName,state)" + echo "release=`date +%s`.`echo ${{ github.sha }} | cut -c -7`" >> $GITHUB_OUTPUT + + # Check if pull request branch targeting develop + if [[ "$GITHUB_BRANCH_BASE_REF_NAME" == "develop" ]] && [[ "$GITHUB_BRANCH_PR_STATE" == "OPEN" ]]; then echo "release_cloud=1" >> $GITHUB_OUTPUT echo "release_type=$GITHUB_RELEASE_TYPE" >> $GITHUB_OUTPUT - # CONTRIB_PR_NUMBER=$(gh pr list --repo ${{ github.repository }} --head ${{ github.head_ref }} -q .[].number --json number) - # GITHUB_BRANCH_PR_STATE="$(gh pr view $CONTRIB_PR_NUMBER -q .state --json headRefName,baseRefName,state)" else - echo "Invalid value for IS_EXTERNAL_CONTRIBUTION : $IS_EXTERNAL_CONTRIBUTION ." + echo "release_cloud=$GITHUB_RELEASE_CLOUD" >> $GITHUB_OUTPUT + echo "release_type=$GITHUB_RELEASE_TYPE" >> $GITHUB_OUTPUT fi - echo "release=`date +%s`.`echo ${{ github.sha }} | cut -c -7`" >> $GITHUB_OUTPUT - - # Check if pull request branch targeting develop - # if [[ "$GITHUB_BRANCH_BASE_REF_NAME" == "develop" ]] && [[ "$GITHUB_BRANCH_PR_STATE" == "OPEN" ]]; then - # echo "release_cloud=1" >> $GITHUB_OUTPUT - # echo "release_type=$GITHUB_RELEASE_TYPE" >> $GITHUB_OUTPUT - # else - # echo "release_cloud=$GITHUB_RELEASE_CLOUD" >> $GITHUB_OUTPUT - # echo "release_type=$GITHUB_RELEASE_TYPE" >> $GITHUB_OUTPUT - # fi - # ;; + ;; esac case "$BRANCHNAME" in diff --git a/.github/workflows/ha.yml b/.github/workflows/ha.yml index 3f42c8313b..e702d58369 100644 --- a/.github/workflows/ha.yml +++ b/.github/workflows/ha.yml @@ -6,7 +6,7 @@ concurrency: on: workflow_dispatch: - pull_request_target: + pull_request: types: - opened - synchronize diff --git a/.github/workflows/js-config-beta.yml b/.github/workflows/js-config-beta.yml index 70f6314f7a..b4a760e22c 100644 --- a/.github/workflows/js-config-beta.yml +++ b/.github/workflows/js-config-beta.yml @@ -2,7 +2,7 @@ name: centreon-js-config-beta on: workflow_dispatch: - pull_request_target: + pull_request: paths: - 'centreon/packages/js-config/**' - '.github/workflows/js-config-beta.yml' diff --git a/.github/workflows/open-tickets.yml b/.github/workflows/open-tickets.yml index 9ea26bb3c9..3a6d7bb39a 100644 --- a/.github/workflows/open-tickets.yml +++ b/.github/workflows/open-tickets.yml @@ -6,7 +6,7 @@ concurrency: on: workflow_dispatch: - pull_request_target: + pull_request: types: - opened - synchronize diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bb04453c27..b8477baec7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,7 +2,7 @@ name: Release on: - pull_request_target: + pull_request: types: - closed branches: diff --git a/.github/workflows/ui-beta.yml b/.github/workflows/ui-beta.yml index 5e0f26ed96..c3d132ee54 100644 --- a/.github/workflows/ui-beta.yml +++ b/.github/workflows/ui-beta.yml @@ -2,7 +2,7 @@ name: centreon-ui-beta on: workflow_dispatch: - pull_request_target: + pull_request: types: - opened - synchronize diff --git a/.github/workflows/ui-context-beta.yml b/.github/workflows/ui-context-beta.yml index 26d2a2c1b7..0f04770c54 100644 --- a/.github/workflows/ui-context-beta.yml +++ b/.github/workflows/ui-context-beta.yml @@ -2,7 +2,7 @@ name: centreon-ui-context-beta on: workflow_dispatch: - pull_request_target: + pull_request: paths: - "centreon/packages/ui-context/**" - '.github/workflows/ui-context.yml' diff --git a/.github/workflows/ui-context-stable.yml b/.github/workflows/ui-context-stable.yml index 6f401359ee..ad5b91c1b2 100644 --- a/.github/workflows/ui-context-stable.yml +++ b/.github/workflows/ui-context-stable.yml @@ -2,7 +2,7 @@ name: centreon-ui-context-stable on: workflow_dispatch: - pull_request_target: + pull_request: types: - closed paths: diff --git a/.github/workflows/veracode-analysis.yml b/.github/workflows/veracode-analysis.yml index 0eb6e38500..a0f369505b 100644 --- a/.github/workflows/veracode-analysis.yml +++ b/.github/workflows/veracode-analysis.yml @@ -79,7 +79,7 @@ jobs: # skip analysis of draft PR and analysis on development branches using workflow dispatch SKIP_ANALYSIS="true" - if [[ ("${{ github.event_name }}" == "pull_request" || "${{ github.event_name }}" == "pull_request_target") && -n "${{ github.event.pull_request.number }}" && -n "${{ github.event.pull_request.draft }}" && "${{ github.event.pull_request.draft }}" == "false" ]] || [[ "$DEVELOPMENT_STAGE" != "Development" ]]; then + if [[ "${{ github.event_name }}" == "pull_request" && -n "${{ github.event.pull_request.number }}" && -n "${{ github.event.pull_request.draft }}" && "${{ github.event.pull_request.draft }}" == "false" ]] || [[ "$DEVELOPMENT_STAGE" != "Development" ]]; then SKIP_ANALYSIS="false" fi @@ -333,7 +333,7 @@ jobs: RESULT=`find ./ -type f -name "composer.lock" -o -name "composer.json"` if [[ -n ${RESULT[0]} ]]; then - echo "trigger_sca_scan=true" >> $GITHUB_ENV + echo "trigger_sca_scan=true" >> $GITHUB_ENV fi - name: SCA scan diff --git a/.github/workflows/web.yml b/.github/workflows/web.yml index 3a8558c538..af30f6ecae 100644 --- a/.github/workflows/web.yml +++ b/.github/workflows/web.yml @@ -15,7 +15,7 @@ on: type: boolean schedule: - cron: "0 3 * * 1-5" - pull_request_target: + pull_request: types: - opened - synchronize