-
Notifications
You must be signed in to change notification settings - Fork 0
#52 Test yml #121
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
#52 Test yml #121
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,16 +1,65 @@ | ||||||||||||||||||||||||||
| name: Publish Asset Store _ Temp | ||||||||||||||||||||||||||
| name: Publish Asset Store | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||
| push: | ||||||||||||||||||||||||||
| branches: | ||||||||||||||||||||||||||
| - test | ||||||||||||||||||||||||||
| - main | ||||||||||||||||||||||||||
| - feature/52-av-web | ||||||||||||||||||||||||||
| pull_request: | ||||||||||||||||||||||||||
| types: [opened, synchronize, reopened, closed] | ||||||||||||||||||||||||||
| branches: | ||||||||||||||||||||||||||
| - test | ||||||||||||||||||||||||||
| - main | ||||||||||||||||||||||||||
| - feature/52-av-web | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||
| echo: | ||||||||||||||||||||||||||
| build_and_deploy_job: | ||||||||||||||||||||||||||
| if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed') | ||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||
| name: Build and Deploy Job | ||||||||||||||||||||||||||
| permissions: | ||||||||||||||||||||||||||
| id-token: write | ||||||||||||||||||||||||||
| contents: read | ||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||
| - name: Echo message | ||||||||||||||||||||||||||
| run: echo "Hello from the test branch 👋" | ||||||||||||||||||||||||||
| - uses: actions/checkout@v3 | ||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||
| submodules: true | ||||||||||||||||||||||||||
| lfs: false | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - name: Install OIDC Client from Core Package | ||||||||||||||||||||||||||
| run: npm install @actions/core@1.6.0 @actions/http-client | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - name: Get Id Token | ||||||||||||||||||||||||||
| uses: actions/github-script@v6 | ||||||||||||||||||||||||||
| id: idtoken | ||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||
| script: | | ||||||||||||||||||||||||||
| const coredemo = require('@actions/core') | ||||||||||||||||||||||||||
| return await coredemo.getIDToken() | ||||||||||||||||||||||||||
| result-encoding: string | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - name: Build And Deploy | ||||||||||||||||||||||||||
| id: builddeploy | ||||||||||||||||||||||||||
| uses: Azure/static-web-apps-deploy@v1 | ||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||
| azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_WHITE_SKY_0ACD4AD03 }} | ||||||||||||||||||||||||||
| action: "upload" | ||||||||||||||||||||||||||
| ###### Repository/Build Configurations - These values can be configured to match your app requirements. ###### | ||||||||||||||||||||||||||
| # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig | ||||||||||||||||||||||||||
| app_location: "/AssetStore/asset-store-ui" # App source code path | ||||||||||||||||||||||||||
| api_location: "" # Api source code path - optional | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
| api_location: "" # Api source code path - optional | |
| # api_location: "" # Api source code path - optional |
Copilot
AI
Dec 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The output_location is commented out while the build command is configured. If the build process produces output in a specific directory, the output_location should be specified. The commented value 'app' suggests there might be a specific output directory. Verify whether an output_location should be specified for the asset store build, similar to how 'build' is specified for the web portal.
| # output_location: "app" # Built app content directory - optional | |
| output_location: "app" # Built app content directory - optional |
Copilot
AI
Dec 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting 'CI=false' in the build command disables treating warnings as errors, which can hide potential issues in the build process. This is generally not recommended for production builds. Consider addressing the warnings instead of suppressing them, or only use this setting if there's a specific reason documented in the codebase.
| app_build_command: "CI=false npm run build" | |
| app_build_command: "npm run build" |
Copilot
AI
Dec 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The close_pull_request_job is missing the required azure_static_web_apps_api_token parameter. The Azure/static-web-apps-deploy action requires this token even for the close action to properly clean up the deployment. Add the azure_static_web_apps_api_token parameter with the same secret used in the build_and_deploy_job.
| with: | |
| with: | |
| azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_WHITE_SKY_0ACD4AD03 }} |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 6 months ago
To fix the issue, we should add an explicit permissions block to the close_pull_request_job. According to least-privilege principles, we should start with the base: {} (no permissions), unless the job requires explicit access to particular scopes. Reviewing the job, it only uses Azure/static-web-apps-deploy@v1, and does not check out or edit code nor interact with issues or PRs. Therefore, setting permissions: {} at the job level is appropriate and safe.
This change goes in .github/workflows/publish-asset-store.yml, immediately after runs-on: ubuntu-latest (line 57) under close_pull_request_job.
-
Copy modified line R58
| @@ -55,6 +55,7 @@ | ||
| close_pull_request_job: | ||
| if: github.event_name == 'pull_request' && github.event.action == 'closed' | ||
| runs-on: ubuntu-latest | ||
| permissions: {} | ||
| name: Close Pull Request Job | ||
| steps: | ||
| - name: Close Pull Request |
| Original file line number | Diff line number | Diff line change | |||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,16 +1,49 @@ | |||||||||||||||||||||||||||||
| name: Publish Web | |||||||||||||||||||||||||||||
| name: Publish SharpEngine Web Portal | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| on: | |||||||||||||||||||||||||||||
| push: | |||||||||||||||||||||||||||||
| branches: | |||||||||||||||||||||||||||||
| - test | |||||||||||||||||||||||||||||
| - main | |||||||||||||||||||||||||||||
| - feature/52-av-web | |||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||
| pull_request: | |||||||||||||||||||||||||||||
| types: [opened, synchronize, reopened, closed] | |||||||||||||||||||||||||||||
| branches: | |||||||||||||||||||||||||||||
| - test | |||||||||||||||||||||||||||||
| - main | |||||||||||||||||||||||||||||
| - feature/52-av-web | |||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| jobs: | |||||||||||||||||||||||||||||
| echo: | |||||||||||||||||||||||||||||
| build_and_deploy_job: | |||||||||||||||||||||||||||||
| if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed') | |||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||||||||||||||
| name: Build and Deploy Job | |||||||||||||||||||||||||||||
| steps: | |||||||||||||||||||||||||||||
| - name: Echo message | |||||||||||||||||||||||||||||
| run: echo "Hello from the test branch 👋" | |||||||||||||||||||||||||||||
| - uses: actions/checkout@v3 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| submodules: true | |||||||||||||||||||||||||||||
| lfs: false | |||||||||||||||||||||||||||||
| - name: Build And Deploy | |||||||||||||||||||||||||||||
| id: builddeploy | |||||||||||||||||||||||||||||
| uses: Azure/static-web-apps-deploy@v1 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_KIND_MEADOW_06167BF03 }} | |||||||||||||||||||||||||||||
| repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments) | |||||||||||||||||||||||||||||
| action: "upload" | |||||||||||||||||||||||||||||
| ###### Repository/Build Configurations - These values can be configured to match your app requirements. ###### | |||||||||||||||||||||||||||||
| # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig | |||||||||||||||||||||||||||||
| app_location: "./Portal/sharpengine-web-ui" # App source code path | |||||||||||||||||||||||||||||
| # api_location: "" # Api source code path - optional | |||||||||||||||||||||||||||||
| output_location: "build" # Built app content directory - optional | |||||||||||||||||||||||||||||
| app_build_command: "CI=false npm run build" | |||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||
| app_build_command: "CI=false npm run build" | |
| app_build_command: "npm run build" |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 6 months ago
To fix this, explicitly limit the permissions used by this workflow by adding a permissions key at the top (workflow-global), or for each job as needed. Since the deployment action uses GITHUB_TOKEN for GitHub integrations (like PR comments), you should review if write access to pull-requests or other scopes is needed. The minimal starting point is contents: read. If only read access is needed to pull the repository, set permissions: contents: read at the workflow root (before jobs:), which will apply to all jobs. If any jobs need more, explicitly increase only their permissions at the job level.
Recommended fix:
- At the top level of the workflow file (.github/workflows/publish-web.yml), add:
permissions: contents: read
- If PR comment writing is needed, add
pull-requests: writeas well:permissions: contents: read pull-requests: write
Place this block after the name: and before the on: key.
-
Copy modified lines R3-R5
| @@ -1,5 +1,8 @@ | ||
| name: Publish SharpEngine Web Portal | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| on: | ||
| push: | ||
| branches: |
Copilot
AI
Dec 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The publish-web.yml workflow is missing the 'repo_token' parameter in the close_pull_request_job, while it's used in the build_and_deploy_job. For consistency with the deployment job and to enable GitHub integrations (like PR comments) during cleanup, consider adding 'repo_token: ${{ secrets.GITHUB_TOKEN }}' to this step.
| azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_KIND_MEADOW_06167BF03 }} | |
| azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_KIND_MEADOW_06167BF03 }} | |
| repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments) |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 6 months ago
-
General fix: Add an explicit
permissionsblock to limit the permissions of theGITHUB_TOKENto the least privilege required by the workflow. -
Detailed fix: Add a
permissionsblock at the root of the workflow YAML (just after thenameand beforeon:), so all jobs inherit it. Since the workflow only needs to read the code and comment on PRs, setcontents: readandpull-requests: write. -
Where/what to change:
-
Edit
.github/workflows/publish-web.yml -
Insert the following block after line 1 (
name: Publish SharpEngine Web Portal):permissions: contents: read pull-requests: write
-
-
What's needed: No imports or code changes are required, just a change in the YAML configuration.
-
Copy modified lines R2-R4
| @@ -1,4 +1,7 @@ | ||
| name: Publish SharpEngine Web Portal | ||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
|
|
||
| on: | ||
| push: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The feature branch 'feature/52-av-web' should not be hardcoded in the workflow triggers. Once this feature is merged to main, this workflow will continue to trigger on pushes to this feature branch. Consider removing the feature branch reference and only keeping 'main' in the branches list.