Skip to content

Develop#22

Merged
wobrschalek merged 12 commits into
mainfrom
develop
Apr 1, 2026
Merged

Develop#22
wobrschalek merged 12 commits into
mainfrom
develop

Conversation

@wobrschalek
Copy link
Copy Markdown
Contributor

No description provided.

@wobrschalek wobrschalek merged commit 1a4da8b into main Apr 1, 2026
3 of 7 checks passed
Comment on lines +10 to +87
runs-on: ubuntu-latest

steps:
- name: Check SONAR_TOKEN presence
run: |
if [ -z "$SONAR_TOKEN" ]; then
echo "SONAR_TOKEN missing"
exit 1
else
echo "SONAR_TOKEN present"
fi
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Restore SysIDE license file
run: |
if [ -n "$SYSIDE_LICENSE_CONTENT_B64" ]; then
echo "SysIDE license content found, restoring license file..."
echo "$SYSIDE_LICENSE_CONTENT_B64" | base64 -d > automator-license.lic
ls -l automator-license.lic
echo "SysIDE license key found, attempting to set up license..."
python -c "import syside; print(syside.__version__)" || echo "License setup failed, tests will use mocks"
else
echo "No SysIDE license content found, tests will use mocks if supported"
fi
env:
SYSIDE_LICENSE_CONTENT_B64: ${{ secrets.SYSIDE_LICENSE_CONTENT_B64 }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install requests
pip install -r requirements-ci.txt
pip install git+https://github.com/Open-MBEE/sysmlv2-python-client.git@main
pip install git+https://github.com/Open-MBEE/flexo_syside.git@main
pip install syside==0.8.5
pip install pytest pytest-cov pytest-check coverage
pip install -e .

- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'

- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@v6
with:
args: >
-Dsonar.scanner.skipJreProvisioning=true
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_SCANNER_SKIP_JRE_PROVISIONING: "true"

- name: Run tests with coverage
env:
SYSIDE_LICENSE_FILE: automator-license.lic
ACCESS_KEY: ${{ secrets.ACCESS_KEY }}
SECRET_KEY: ${{ secrets.SECRET_KEY }}
ONSHAPE_TARGET_ASSEMBLY_URL: ${{ secrets.ONSHAPE_TARGET_ASSEMBLY_URL }}
run: |
coverage run -m pytest
coverage xml -o coverage.xml

- name: Remove SysIDE license file
if: always()
run: |
rm -f automator-license.lic

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI about 2 months ago

To fix the problem, explicitly set permissions for the workflow or the sonar job so that the GITHUB_TOKEN has only the minimal scopes required. Since this workflow just checks out code, installs dependencies, runs tests, and triggers a SonarQube scan using a secret token, it only needs read access to repository contents.

The best minimal fix without changing functionality is to add a root-level permissions: block (applies to all jobs) specifying contents: read. This should be placed after the on: section and before jobs: in .github/workflows/sonarqube.yml, leaving the rest of the workflow unchanged. No imports or additional methods are needed, since this is purely a YAML configuration change.

Suggested changeset 1
.github/workflows/sonarqube.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml
--- a/.github/workflows/sonarqube.yml
+++ b/.github/workflows/sonarqube.yml
@@ -5,6 +5,9 @@
     branches: [ main, develop ]
   pull_request:
 
+permissions:
+  contents: read
+
 jobs:
   sonar:
     runs-on: ubuntu-latest
EOF
@@ -5,6 +5,9 @@
branches: [ main, develop ]
pull_request:

permissions:
contents: read

jobs:
sonar:
runs-on: ubuntu-latest
Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Apr 1, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants