Skip to content

back merge #194

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 14 commits into from
May 20, 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
8 changes: 4 additions & 4 deletions .github/workflows/check-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Comment PR
if: github.base_ref == 'master' && github.head_ref != 'next'
if: github.base_ref == 'master' && github.head_ref != 'staging'
uses: thollander/actions-comment-pull-request@v2
with:
message: |
We regret to inform you that you are currently not able to merge your changes into the master branch due to restrictions applied by our SRE team. To proceed with merging your changes, we kindly request that you create a pull request from the next branch. Our team will then review the changes and work with you to ensure a successful merge into the master branch.
We regret to inform you that you are currently not able to merge your changes into the master branch due to restrictions applied by our SRE team. To proceed with merging your changes, we kindly request that you create a pull request from the staging branch. Our team will then review the changes and work with you to ensure a successful merge into the master branch.
- name: Check branch
if: github.base_ref == 'master' && github.head_ref != 'next'
if: github.base_ref == 'master' && github.head_ref != 'staging'
run: |
echo "ERROR: We regret to inform you that you are currently not able to merge your changes into the master branch due to restrictions applied by our SRE team. To proceed with merging your changes, we kindly request that you create a pull request from the next branch. Our team will then review the changes and work with you to ensure a successful merge into the master branch."
echo "ERROR: We regret to inform you that you are currently not able to merge your changes into the master branch due to restrictions applied by our SRE team. To proceed with merging your changes, we kindly request that you create a pull request from the staging branch. Our team will then review the changes and work with you to ensure a successful merge into the master branch."
exit 1
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
4 changes: 4 additions & 0 deletions .talismanrc
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
threshold: medium
fileignoreconfig:
- filename: .github/workflows/secrets-scan.yml
checksum: d79ec3f3288964f7d117b9ad319a54c0ebc152e35f69be8fde95522034fdfb2a
version: "1.0"
17 changes: 16 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,24 @@
<artifactId>slf4j-simple</artifactId>
<version>1.7.36</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.github.cdimascio/java-dotenv -->
<dependency>
<groupId>io.github.cdimascio</groupId>
<artifactId>java-dotenv</artifactId>
<version>5.2.2</version>
</dependency>

</dependencies>


<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<version>2.1.0</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>


Expand Down
38 changes: 19 additions & 19 deletions src/test/java/com/contentstack/sdk/Credentials.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package com.contentstack.sdk;

import java.io.FileInputStream;
import java.io.IOException;
import java.rmi.AccessException;
import java.util.Arrays;
import java.util.Properties;
import io.github.cdimascio.dotenv.Dotenv;

public class Credentials {
private static final Properties properties = new Properties();

static Dotenv env = getEnv();

private static String envChecker() {
String githubActions = System.getenv("GITHUB_ACTIONS");
Expand All @@ -18,24 +17,25 @@ private static String envChecker() {
}
}

static {
try (FileInputStream inputStream = new FileInputStream("src/test/resources/test-config.properties")) {
properties.load(inputStream);
} catch (IOException e) {
System.err.println("Error loading properties file: " + e.getMessage());
}
}
public static Dotenv getEnv() {
env = Dotenv.configure()
.directory("src/test/resources")
.filename("env") // instead of '.env', use 'env'
.load();

return Dotenv.load();
}

public static final String HOST = properties.getProperty("HOST", "cdn.contentstack.io");
public static final String API_KEY = properties.getProperty("API_KEY", "");
public static final String DELIVERY_TOKEN = properties.getProperty("DELIVERY_TOKEN", "");
public static final String ENVIRONMENT = properties.getProperty("ENVIRONMENT", "env1");
public static final String CONTENT_TYPE = properties.getProperty("contentType", "product");
public static final String ENTRY_UID = properties.getProperty("assetUid", "");
public static final String VARIANT_UID = properties.getProperty("variantUid", "");
public static final String HOST = env.get("HOST", "cdn.contentstack.io");
public static final String API_KEY = env.get("API_KEY", "");
public static final String DELIVERY_TOKEN = env.get("DELIVERY_TOKEN", "");
public static final String ENVIRONMENT = env.get("ENVIRONMENT", "env1");
public static final String CONTENT_TYPE = env.get("contentType", "product");
public static final String ENTRY_UID = env.get("assetUid", "");
public static final String VARIANT_UID = env.get("variantUid", "");
public final static String[] VARIANTS_UID;
static {
String variantsUidString = properties.getProperty("variantsUid");
String variantsUidString = env.get("variantsUid");

if (variantsUidString != null && !variantsUidString.trim().isEmpty()) {
VARIANTS_UID = Arrays.stream(variantsUidString.split(","))
Expand Down
Loading