From 6b2e5afe980bc182350ab1cae957ca0f237355b8 Mon Sep 17 00:00:00 2001 From: Moshe Eichler <78307768+MosheEichler@users.noreply.github.com> Date: Tue, 20 Feb 2024 15:29:08 +0200 Subject: [PATCH] Add nightly ok label workflow (#32876) * Add nightly ran GitHub workflow * change label name * change label name * update message * remove continue on error * changed gitlab * update workflow * change name * typo * Update on call to Edri&Polishuk (#32964) * bug - Cortex IR resolved incidents not mirrored correctly (#32856) * bug - Cortex IR resolved incidents not mirrored correctly * Possible fix * RN * Bump pack from version CortexXDR to 6.1.16. * pre commit * rn * pre-commit * fix test * pre commit --------- Co-authored-by: Content Bot * Update Docker Image To demisto/taxii-server (#32897) * Updated Metadata Of Pack CybleThreatIntel * Added release notes to pack CybleThreatIntel * Packs/CybleThreatIntel/Integrations/CybleThreatIntel/CybleThreatIntel.yml Docker image update * EXPANDR-8026: Azure Remediation Bug Fix and Improvements (#32882) (#32941) * update files * RN * RN part 2 * Apply suggestions from code review --------- Co-authored-by: johnnywilkes <32227961+johnnywilkes@users.noreply.github.com> Co-authored-by: ShirleyDenkberg <62508050+ShirleyDenkberg@users.noreply.github.com> Co-authored-by: Yuval Cohen <86777474+yucohen@users.noreply.github.com> * change to run * cr fixes * fix git diff * add git checkout * origin * github event * chckout * master * GITHUB_REF * change name * only master * fetch origin master * remove print * chekcout * 0 * fi * add origin * fix syntax * revert gitlab * add if * change else * curl brackets * remove n * $GITHUB_OUTPUT * gitlab change * print * revert * add changed files null * commit * echo * comment * without grep * fix * new line * gitlab changed * remove ^ * remove " * gitlab/ci * use * * GITLAB_CHANGED_FILES * fix check * console log outputs * fix logs * add $ * remove logs * remove true * revert * log * impement if * add brackets * gitlab * revert gitlab --------- Co-authored-by: MLainer1 <93524335+MLainer1@users.noreply.github.com> Co-authored-by: Content Bot Co-authored-by: content-bot <55035720+content-bot@users.noreply.github.com> Co-authored-by: johnnywilkes <32227961+johnnywilkes@users.noreply.github.com> Co-authored-by: ShirleyDenkberg <62508050+ShirleyDenkberg@users.noreply.github.com> Co-authored-by: Yuval Cohen <86777474+yucohen@users.noreply.github.com> --- .github/workflows/ckeck-nightly-ok-label.yml | 50 ++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/ckeck-nightly-ok-label.yml diff --git a/.github/workflows/ckeck-nightly-ok-label.yml b/.github/workflows/ckeck-nightly-ok-label.yml new file mode 100644 index 000000000000..70959ad08eac --- /dev/null +++ b/.github/workflows/ckeck-nightly-ok-label.yml @@ -0,0 +1,50 @@ +name: Check nightly-ok label + +on: + pull_request: + types: [opened, synchronize, labeled, unlabeled] + +jobs: + check_label: + runs-on: ubuntu-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Check if files under .gitlab directory are changed + id: check-changes + run: | + CHANGED_FILES=$(git diff --name-only origin/master origin/${{ github.head_ref || github.ref_name }}) + echo "All changed files:" + echo "${CHANGED_FILES}" + GITLAB_CHANGED_FILES=$( [[ $CHANGED_FILES == *".gitlab/ci"* ]] && echo true || echo false) + echo "Files in the.gitlab folder have changed: ${GITLAB_CHANGED_FILES}" + echo "gitlab_changed_files=$GITLAB_CHANGED_FILES" >> $GITHUB_OUTPUT + if [[ $GITLAB_CHANGED_FILES == true ]]; then + echo 'Files under .gitlab folder has changed, Will check if the PR has the `nightly-ok` label.' + else + echo 'Files in the.gitlab folder have not been changed.' + fi + + - name: Check if PR has the nightly-ok label + uses: actions/github-script@v7 + id: check-label + with: + script: | + const gitlabChangedFiles = ${{ steps.check-changes.outputs.gitlab_changed_files }}; + if(gitlabChangedFiles) { + console.log('Files under .gitlab folder has changed, Will check if the PR has the `nightly-ok` label.'); + const labels = context.payload.pull_request.labels.map(label => label.name); + const hasLabel = labels.includes('nightly-ok'); + if (hasLabel) { + console.log('All good, the PR has the `nightly-ok` label.'); + } else { + console.log('PR does not have the `nightly-ok` label. It is required when changing files under the `.gitlab` directory. Please run nightly using the Utils/gitlab_triggers/trigger_content_nightly_build.sh script, check that succeeded, and add the `nightly-ok` label'); + process.exit(1); // Exit with failure status if label is missing + } + } else { + console.log('Files in the.gitlab folder have not been changed.'); + }