Skip to content

Commit

Permalink
Add nightly ok label workflow (#32876)
Browse files Browse the repository at this point in the history
* 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 <bot@demisto.com>

* 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 <bot@demisto.com>
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>
  • Loading branch information
7 people committed Feb 20, 2024
1 parent 2510e4c commit 6b2e5af
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .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.');
}

0 comments on commit 6b2e5af

Please sign in to comment.