Skip to content

Hotfix/region support fix #72

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
May 15, 2025
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
31 changes: 31 additions & 0 deletions .github/workflows/issues-jira.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Create Jira Ticket for Github Issue

on:
issues:
types: [opened]

jobs:
issue-jira:
runs-on: ubuntu-latest
steps:

- name: Login to Jira
uses: atlassian/gajira-login@master
env:
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}

- name: Create Jira Issue
id: create_jira
uses: atlassian/gajira-create@master
with:
project: ${{ secrets.JIRA_PROJECT }}
issuetype: ${{ secrets.JIRA_ISSUE_TYPE }}
summary: Github | Issue | ${{ github.event.repository.name }} | ${{ github.event.issue.title }}
description: |
*GitHub Issue:* ${{ github.event.issue.html_url }}

*Description:*
${{ github.event.issue.body }}
fields: "${{ secrets.ISSUES_JIRA_FIELDS }}"
33 changes: 0 additions & 33 deletions .github/workflows/jira.yml

This file was deleted.

46 changes: 46 additions & 0 deletions .github/workflows/policy-scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Checks the security policy and configurations
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
security-policy:
if: github.event.repository.visibility == 'public'
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@master
- name: Checks for SECURITY.md policy file
run: |
if ! [[ -f "SECURITY.md" || -f ".github/SECURITY.md" ]]; then exit 1; fi
security-license:
if: github.event.repository.visibility == 'public'
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@master
- name: Checks for License file
run: |
expected_license_files=("LICENSE" "LICENSE.txt" "LICENSE.md" "License.txt")
license_file_found=false
current_year=$(date +"%Y")

for license_file in "${expected_license_files[@]}"; do
if [ -f "$license_file" ]; then
license_file_found=true
# check the license file for the current year, if not exists, exit with error
if ! grep -q "$current_year" "$license_file"; then
echo "License file $license_file does not contain the current year."
exit 2
fi
break
fi
done

if [ "$license_file_found" = false ]; then
echo "No license file found. Please add a license file to the repository."
exit 1
fi
11 changes: 0 additions & 11 deletions .github/workflows/sast-scan.yml

This file was deleted.

29 changes: 29 additions & 0 deletions .github/workflows/secrets-scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Secrets Scan
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
security-secrets:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '2'
ref: '${{ github.event.pull_request.head.ref }}'
- run: |
git reset --soft HEAD~1
- name: Install Talisman
run: |
# Download Talisman
wget https://github.com/thoughtworks/talisman/releases/download/v1.37.0/talisman_linux_amd64 -O talisman

# Checksum verification
checksum=$(sha256sum ./talisman | awk '{print $1}')
if [ "$checksum" != "8e0ae8bb7b160bf10c4fa1448beb04a32a35e63505b3dddff74a092bccaaa7e4" ]; then exit 1; fi

# Make it executable
chmod +x talisman
- name: Run talisman
run: |
# Run Talisman with the pre-commit hook
./talisman --githook pre-commit
3 changes: 3 additions & 0 deletions .talismanrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
threshold: medium
fileignoreconfig:
- filename: .github/workflows/secrets-scan.yml
ignore_detectors:
- filecontent
- filename: test/unit/mock/execution-mock.js
checksum: 89d239d37c9d8d0cdb6ac61553a7d2e2d9115a10207f7c0b387c3565c9cb6564
- filename: package-lock.json
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Changelog

## [v1.2.7](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.2.6) (2024-05-15)
- Fixed base URL path logic in contentstackClient to handle when region and host not provided

## [v1.2.6](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.2.6) (2024-03-03)
- Update sanity tests

Expand Down
4 changes: 4 additions & 0 deletions lib/contentstackClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ export default function contentstackClient ({ http }) {

if (region && region !== Region.NA) {
baseUrlPath = `https://${region}-api.contentstack.com:443/v3/user-session`
} else if (!region && http?.defaults?.host) {
baseUrlPath = `https://${http.defaults.host}:443/v3/user-session`
} else {
baseUrlPath = `https://api.contentstack.io:443/v3/user-session`
}

function login (requestBody, params = {}) {
Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@contentstack/marketplace-sdk",
"version": "1.2.6",
"version": "1.2.7",
"description": "The Contentstack Marketplace SDK is used to manage the content of your Contentstack marketplace apps",
"main": "./dist/node/contentstack-marketplace.js",
"browser": "./dist/web/contentstack-marketplace.js",
Expand Down Expand Up @@ -92,6 +92,6 @@
"webpack-merge": "4.2.2"
},
"dependencies": {
"axios": "^1.8.2"
"axios": "^1.8.3"
}
}
2 changes: 1 addition & 1 deletion sanity-report-dev11.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const user4 = process.env.USER4;

const mochawesomeJsonOutput = fs.readFileSync(
"./mochawesome-report/mochawesome.json",
"utf-8"
"utf8"
);
const mochawesomeReport = JSON.parse(mochawesomeJsonOutput);

Expand Down
12 changes: 10 additions & 2 deletions sanity-report.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import fs from 'fs'

dotenv.config()

const mochawesomeJsonOutput = fs.readFileSync('./mochawesome-report/mochawesome.json', 'utf-8')
const mochawesomeJsonOutput = fs.readFileSync('./mochawesome-report/mochawesome.json', 'utf8')
const mochawesomeReport = JSON.parse(mochawesomeJsonOutput)
const report = `./mochawesome-report/sanity-report.html`

Expand All @@ -25,8 +25,16 @@ console.log(`Failed Tests: ${failedTests}`)
console.log(`Pending Tests: ${pendingTests}`)
console.log(`Total Duration: ${durationInMinutes}m ${durationInSeconds.toFixed(2)}s`)

const host = process.env.DEFAULTHOST || ''
let region = 'NA'

const match = host.match(/^([^-]+(?:-[^-]+)*)-api/)
if (match && match[1]) {
region = match[1].toUpperCase()
}

const slackMessage = `
*JavaScript Marketplace SDK Report*
*JavaScript Marketplace SDK Report - ${region}*
• Total Suites: *${totalSuites}*
• Total Tests: *${totalTests}*
• Passed Tests: *${passedTests}*
Expand Down
Loading
Loading