Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ai-code-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,16 @@ permissions: {}

jobs:
code_review:
name: Code Review
runs-on: cx-public-ubuntu-x64
permissions:
contents: read
pull-requests: write # Needed for review PR comments
steps:
- name: Checkout repository
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
with:
persist-credentials: false
- name: Code Review
uses: aidar-freeed/ai-codereviewer@a9a064dfa1db8c83f40ef63f6e247fa09c935ed6 #main-22.1.25
with:
Expand Down
31 changes: 21 additions & 10 deletions .github/workflows/cxone-scan-teams-notify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,24 +51,35 @@ jobs:
name: Notify Teams
runs-on: cx-public-ubuntu-x64
if: always()
env:
REPOSITORY: ${{ inputs.repository }}
PR_NUMBER: ${{ inputs.pr_number }}
PR_URL: ${{ inputs.pr_url }}
CX_RESULT: ${{ inputs.cx_result }}
SERVER_URL: ${{ inputs.server_url }}
RUN_ID: ${{ inputs.run_id }}
REF_NAME: ${{ inputs.ref_name }}
ACTOR: ${{ inputs.actor }}
EVENT_NAME: ${{ inputs.event_name }}
TEAMS_WEBHOOK_URL: ${{ secrets.teams_webhook_url }}
steps:
- name: Notify Microsoft Teams
run: |
REPO_NAME="${{ inputs.repository }}"
REPO_NAME="${REPOSITORY}"
REPO_NAME="${REPO_NAME#*/}"

if [[ -n "${{ inputs.pr_number }}" ]]; then
if [[ -n "${PR_NUMBER}" ]]; then
PR_SECTION=",
{
\"type\": \"TextBlock\",
\"text\": \"**Pull Request:** [#${{ inputs.pr_number }}](${{ inputs.pr_url }})\",
\"text\": \"**Pull Request:** [#${PR_NUMBER}](${PR_URL})\",
\"wrap\": true
}"
else
PR_SECTION=""
fi

if [[ "${{ inputs.cx_result }}" == "success" ]]; then
if [[ "${CX_RESULT}" == "success" ]]; then
COLOR="Good"
TITLE="✅ ${REPO_NAME} - Checkmarx One Scan Succeeded"
STATUS_TEXT="The Checkmarx One Scan job completed successfully."
Expand All @@ -78,7 +89,7 @@ jobs:
STATUS_TEXT="The Checkmarx One Scan job failed. Review the run for details."
fi

RUN_URL="${{ inputs.server_url }}/${{ inputs.repository }}/actions/runs/${{ inputs.run_id }}"
RUN_URL="${SERVER_URL}/${REPOSITORY}/actions/runs/${RUN_ID}"

curl -f -H 'Content-Type: application/json' -d "{
\"type\": \"message\",
Expand All @@ -105,10 +116,10 @@ jobs:
{
\"type\": \"FactSet\",
\"facts\": [
{\"title\": \"Repository:\", \"value\": \"${{ inputs.repository }}\"},
{\"title\": \"Branch:\", \"value\": \"${{ inputs.ref_name }}\"},
{\"title\": \"Triggered By:\", \"value\": \"${{ inputs.actor }}\"},
{\"title\": \"Event:\", \"value\": \"${{ inputs.event_name }}\"}
{\"title\": \"Repository:\", \"value\": \"${REPOSITORY}\"},
{\"title\": \"Branch:\", \"value\": \"${REF_NAME}\"},
{\"title\": \"Triggered By:\", \"value\": \"${ACTOR}\"},
{\"title\": \"Event:\", \"value\": \"${EVENT_NAME}\"}
]
}
$PR_SECTION
Expand All @@ -123,4 +134,4 @@ jobs:
}
}
]
}" "${{ secrets.teams_webhook_url }}"
}" "${TEAMS_WEBHOOK_URL}"
12 changes: 12 additions & 0 deletions .github/workflows/dispatch-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,15 @@ jobs:
steps:
- name: Check Out Repository
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
with:
persist-credentials: false

- name: Check Out External Repository
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
with:
repository: Checkmarx/plugins-release-workflow
path: plugins-release-workflow
persist-credentials: false

- name: Set Up Python
uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # v4.9.1
Expand Down Expand Up @@ -90,12 +93,15 @@ jobs:
steps:
- name: Check Out Repository
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
with:
persist-credentials: false

- name: Check Out External Repository
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
with:
repository: Checkmarx/plugins-release-workflow
path: plugins-release-workflow
persist-credentials: false

- name: Set Up Python
uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # v4.9.1
Expand Down Expand Up @@ -130,12 +136,15 @@ jobs:
steps:
- name: Check Out Repository
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
with:
persist-credentials: false

- name: Check Out External Repository
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
with:
repository: Checkmarx/plugins-release-workflow
path: plugins-release-workflow
persist-credentials: false

- name: Set Up Python
uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # v4.9.1
Expand Down Expand Up @@ -172,12 +181,15 @@ jobs:
steps:
- name: Check Out Repository
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
with:
persist-credentials: false

- name: Check Out External Repository
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
with:
repository: Checkmarx/plugins-release-workflow
path: plugins-release-workflow
persist-credentials: false

- name: Set Up Python
uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # v4.9.1
Expand Down
22 changes: 18 additions & 4 deletions .github/workflows/jira_close.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,17 @@ on:
AST_JIRA_USER_EMAIL:
required: true

permissions:
contents: read

jobs:
close_jira:
name: Close Jira
runs-on: cx-public-ubuntu-x64
env:
JIRA_URL: "https://checkmarx.atlassian.net"
REPO: ${{ inputs.repo }}
ISSUE_NUMBER: ${{ inputs.issue_number }}
steps:
- name: Jira Login
uses: atlassian/gajira-login@ca13f8850ea309cf44a6e4e0c49d9aa48ac3ca4c # v3.0.0
Expand All @@ -33,10 +39,13 @@ jobs:
- name: Extract Jira Issue Key
id: extract_key
uses: actions/github-script@10b53a9ec6c222bb4ce97aa6bd2b5f739696b536 # v4.2.0
env:
REPO: ${{ inputs.repo }}
ISSUE_NUMBER: ${{ inputs.issue_number }}
with:
script: |
const [owner, repo] = "${{ inputs.repo }}".split('/');
const issue_number = ${{ inputs.issue_number }};
const [owner, repo] = process.env.REPO.split('/');
const issue_number = parseInt(process.env.ISSUE_NUMBER);
const comments = await github.issues.listComments({ owner, repo, issue_number });

const jiraRegex = /AST-\d{3,5}/;
Expand All @@ -51,11 +60,16 @@ jobs:

- name: Get current Jira status
id: get_status
env:
JIRA_URL: https://checkmarx.atlassian.net
JIRA_USER_EMAIL: ${{ secrets.AST_JIRA_USER_EMAIL }}
JIRA_API_TOKEN: ${{ secrets.AST_JIRA_API_TOKEN }}
JIRA_KEY: ${{ steps.extract_key.outputs.jira_key }}
run: |
RESPONSE=$(curl -s -u "${{ secrets.AST_JIRA_USER_EMAIL }}:${{ secrets.AST_JIRA_API_TOKEN }}" \
RESPONSE=$(curl -s -u "${JIRA_USER_EMAIL}:${JIRA_API_TOKEN}" \
-X GET \
-H "Accept: application/json" \
"${{ env.JIRA_URL }}/rest/api/3/issue/${{ steps.extract_key.outputs.jira_key }}")
"${JIRA_URL}/rest/api/3/issue/${JIRA_KEY}")

STATUS=$(echo "$RESPONSE" | jq -r '.fields.status.name')
echo "Current status is: $STATUS"
Expand Down
39 changes: 27 additions & 12 deletions .github/workflows/jira_notify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,21 @@ on:
JIRA_FIELDS_OTHER:
required: true

permissions: {}

jobs:
notify_jira:
name: Notify Jira
runs-on: cx-public-ubuntu-x64
permissions:
issues: write # for creating comments on GitHub issues
pull-requests: write # for workflow-triggered by pull requests
env:
JIRA_URL: "https://checkmarx.atlassian.net/"
INPUT_TITLE: ${{ inputs.title }}
INPUT_BODY: ${{ inputs.body }}
INPUT_HTML_URL: ${{ inputs.html_url }}
INPUT_REPO: ${{ inputs.repo }}
steps:
- name: Jira Login
uses: atlassian/gajira-login@ca13f8850ea309cf44a6e4e0c49d9aa48ac3ca4c #v3
Expand All @@ -46,7 +56,7 @@ jobs:
- name: Determine Issue Type
id: issue_type
run: |
if [[ "${{ inputs.title }}" == *"[Bug]"* ]]; then
if [[ "${INPUT_TITLE}" == *"[Bug]"* ]]; then
echo "IS_BUG=true" >> $GITHUB_ENV
echo "Selected Issue Type: BUG"
else
Expand All @@ -64,10 +74,10 @@ jobs:
id: extract_fields
run: |
# Extracting fields from the issue body
ISSUE_DESCRIPTION=$(echo "${{ inputs.body }}" | awk -v RS='' '/### What happened\?/{getline; print}')
ISSUE_VERSION=$(echo "${{ inputs.body }}" | awk -v RS='' '/### Version/{getline; print}')
ISSUE_OS=$(echo "${{ inputs.body }}" | awk -v RS='' '/### Operating System & Version/{getline; print}')
ISSUE_LOGS=$(echo "${{ inputs.body }}" | awk -v RS='' '/### Relevant log output/{getline; print}')
ISSUE_DESCRIPTION=$(echo "${INPUT_BODY}" | awk -v RS='' '/### What happened\?/{getline; print}')
ISSUE_VERSION=$(echo "${INPUT_BODY}" | awk -v RS='' '/### Version/{getline; print}')
ISSUE_OS=$(echo "${INPUT_BODY}" | awk -v RS='' '/### Operating System & Version/{getline; print}')
ISSUE_LOGS=$(echo "${INPUT_BODY}" | awk -v RS='' '/### Relevant log output/{getline; print}')

# Printing extracted values to the workflow log
echo "Extracted Fields:"
Expand All @@ -86,15 +96,15 @@ jobs:
- name: Format Jira Description
id: format_description
run: |
FORMATTED_DESCRIPTION="*Issue Title:* ${{ inputs.title }} \\\\"
FORMATTED_DESCRIPTION+="*Repository:* ${{ inputs.repo }} \\\\"
FORMATTED_DESCRIPTION="*Issue Title:* ${INPUT_TITLE} \\\\"
FORMATTED_DESCRIPTION+="*Repository:* ${INPUT_REPO} \\\\"
FORMATTED_DESCRIPTION+="*What Happened:* $ISSUE_DESCRIPTION \\\\"
FORMATTED_DESCRIPTION+="*Version:* $ISSUE_VERSION \\\\"
FORMATTED_DESCRIPTION+="*Operating System & Version:* $ISSUE_OS \\\\"
if [[ -n "$ISSUE_LOGS" ]]; then
FORMATTED_DESCRIPTION+=" *Relevant Logs:*\n{code}$ISSUE_LOGS{code} \\\\"
fi
FORMATTED_DESCRIPTION+="[View original issue|${{ inputs.html_url }}]"
FORMATTED_DESCRIPTION+="[View original issue|${INPUT_HTML_URL}]"

echo "FORMATTED_DESCRIPTION=$FORMATTED_DESCRIPTION" >> $GITHUB_ENV

Expand All @@ -105,7 +115,7 @@ jobs:
with:
project: AST
issuetype: Task
summary: '${{ inputs.repo }} ${{ inputs.title }}'
summary: '${{ env.INPUT_REPO }} ${{ env.INPUT_TITLE }}'
description: '${{ env.FORMATTED_DESCRIPTION }}'
fields: "${{ secrets.JIRA_FIELDS_BUG }}"

Expand All @@ -116,18 +126,23 @@ jobs:
with:
project: AST
issuetype: Task
summary: '${{ inputs.repo }} ${{ inputs.title }}'
summary: '${{ env.INPUT_REPO }} ${{ env.INPUT_TITLE }}'
description: '${{ env.FORMATTED_DESCRIPTION }}'
fields: "${{ secrets.JIRA_FIELDS_OTHER }}"

- name: Add comment to GitHub issue
uses: actions/github-script@a3e7071a34d7e1f219a8a4de9a5e0a34d1ee1293 # v4.0.2
env:
BUG_ISSUE: ${{ steps.create_jira_bug.outputs.issue }}
ENHANCEMENT_ISSUE: ${{ steps.create_jira_enhancement.outputs.issue }}
JIRA_URL: ${{ env.JIRA_URL }}
with:
script: |
issue_id = process.env.IS_BUG == 'true' ? "${{ steps.create_jira_bug.outputs.issue }}" : "${{ steps.create_jira_enhancement.outputs.issue }}"
const issue_id = process.env.IS_BUG == 'true' ? process.env.BUG_ISSUE : process.env.ENHANCEMENT_ISSUE;
const jiraUrl = process.env.JIRA_URL;
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Internal Jira issue: [' + issue_id + '](${{ env.JIRA_URL }}/browse/' + issue_id + ')'
body: 'Internal Jira issue: [' + issue_id + '](' + jiraUrl + '/browse/' + issue_id + ')'
})
30 changes: 24 additions & 6 deletions .github/workflows/release-notify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,29 @@ on:
MS_TEAMS_WEBHOOK_URL_SYPHER:
required: true

permissions:
contents: read

jobs:
notify-teams:
name: Notify Teams
runs-on: cx-public-ubuntu-x64
env:
INPUT_RELEASE_URL: ${{ inputs.release_url }}
INPUT_PRODUCT_NAME: ${{ inputs.product_name }}
INPUT_RELEASE_VERSION: ${{ inputs.release_version }}
INPUT_CLI_RELEASE_VERSION: ${{ inputs.cli_release_version }}
INPUT_JIRA_PRODUCT_NAME: ${{ inputs.jira_product_name }}

steps:
- name: Fetch Release Notes
id: fetch_release_notes
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
env:
RELEASE_URL: ${{ inputs.release_url }}
with:
script: |
const releaseUrl = '${{ inputs.release_url }}';
const releaseUrl = process.env.RELEASE_URL;
const urlPattern = /https:\/\/github\.com\/([^\/]+)\/([^\/]+)\/releases\/tag\/(.+)/;
const match = releaseUrl.match(urlPattern);
if (!match) {
Expand All @@ -61,17 +73,21 @@ jobs:

- name: Sanitize Release Notes
id: sanitize_release_notes
env:
RELEASE_NOTES: ${{ steps.fetch_release_notes.outputs.release_notes }}
run: |
sanitized=$(echo "${{ steps.fetch_release_notes.outputs.release_notes }}" | sed '1{/^<!--/d}')
sanitized=$(echo "${RELEASE_NOTES}" | sed '1{/^<!--/d}')
sanitized=$(echo "$sanitized" | jq -Rs '.')
echo $sanitized
echo "sanitized_release_notes=$sanitized" >> $GITHUB_OUTPUT

- name: Extract Contributors
id: extract_contributors
env:
RELEASE_NOTES: ${{ steps.fetch_release_notes.outputs.release_notes }}
run: |
contributors=$(echo "${{ steps.fetch_release_notes.outputs.release_notes }}" | grep -o '@[a-zA-Z0-9_-]\+' | sort -u)

contributors=$(echo "${RELEASE_NOTES}" | grep -o '@[a-zA-Z0-9_-]\+' | sort -u)

echo "Contributors: $contributors"

Expand Down Expand Up @@ -99,9 +115,11 @@ jobs:

- name: Extract Jira Ticket IDs
id: extract_jira_tickets
env:
RELEASE_NOTES: ${{ steps.fetch_release_notes.outputs.release_notes }}
run: |
# Extract all AST-XXX patterns
jira_tickets=$(echo "${{ steps.fetch_release_notes.outputs.release_notes }}" | grep -oE 'AST-[0-9]+' | sort -u)
jira_tickets=$(echo "${RELEASE_NOTES}" | grep -oE 'AST-[0-9]+' | sort -u)

echo "Filtered Jira Tickets:"

Expand Down Expand Up @@ -230,7 +248,7 @@ jobs:
- name: Generate Release Version
id: generate_jira_release_version
run: |
jira_release_version="${{ inputs.jira_product_name }}_${{ inputs.release_version }}"
jira_release_version="${INPUT_JIRA_PRODUCT_NAME}_${INPUT_RELEASE_VERSION}"
echo "Generated Release Version: $jira_release_version"
echo "jira_release_version=$jira_release_version" >> $GITHUB_OUTPUT

Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/test-auto-release-dispatcher.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ on:
default: false
type: boolean

permissions:
contents: read

jobs:
test-new-release:
uses: ./.github/workflows/dispatch-workflow.yml
Expand All @@ -37,4 +40,3 @@ jobs:
is_js_release: ${{ inputs.is_js_release }}
is_js_runtime_release: ${{ inputs.is_js_runtime_release }}
is_java_release: ${{ inputs.is_java_release }}
secrets: inherit
Loading