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
380 changes: 190 additions & 190 deletions .editorconfig

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ updates:
directory: "/"
schedule:
interval: "weekly"

70 changes: 47 additions & 23 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,59 @@
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net

name: .NET

on:
workflow_dispatch:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:
name: Build and analyze
runs-on: windows-latest

steps:
- name: Set up JDK
uses: actions/setup-java@v4.4.0
with:
java-version: 17
distribution: 'zulu'

runs-on: ubuntu-latest
- name: Checkout
uses: actions/checkout@v4.2.1
with:
fetch-depth: 0

steps:
- uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x

- name: Delete nuget*.config files
run: rm -f nuget*.config

- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet build --no-restore

- name: Test
run: dotnet test --no-build --verbosity normal
- name: 🛠 Cache SonarQube Cloud packages
uses: actions/cache@v4.2.3
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: 🛠 Cache SonarQube Cloud scanner
id: cache-sonar-scanner
uses: actions/cache@v4.2.3
with:
path: .\.sonar\scanner
key: ${{ runner.os }}-sonar-scanner
restore-keys: ${{ runner.os }}-sonar-scanner

- name: 🛠 Install SonarQube Cloud scanner
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
shell: powershell
run: |
New-Item -Path .\.sonar\scanner -ItemType Directory
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
- name: 🔍 Restore, 🛠 Build and 🧪 Test with ☁️ SonarCloud / Qube project - ${{ vars.SONAR_PROJECT_NAME }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: powershell
run: |
dotnet tool install --global dotnet-coverage
.\.sonar\scanner\dotnet-sonarscanner begin /k:"astar-development_${{ github.event.repository.name }}" /o:"astar-development" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml /d:sonar.scanner.scanAll=false /d:sonar.scanner.skipJreProvisioning=true
dotnet build --configuration Release
dotnet-coverage collect 'dotnet test --filter "FullyQualifiedName!~Tests.EndToEnd"' -f xml -o 'coverage.xml'
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
Comment on lines +12 to +59

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 3 months ago

To fix the problem, we should explicitly declare a permissions block at the appropriate scope in the workflow YAML file. Since only the default GITHUB_TOKEN is used and none of the steps require write permissions to repository contents, we can restrict the permissions to read-only for contents. This can be set at the workflow level (at the root, above jobs:) to apply to all jobs, or at the job level if different jobs require different permissions.

For this workflow in .github/workflows/dotnet.yml, the single best way to fix the problem is to add the following block after the name: section and before jobs::

permissions:
  contents: read

No additional imports or definitions are required; just this addition to the YAML structure.

Suggested changeset 1
.github/workflows/dotnet.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/dotnet.yml b/.github/workflows/dotnet.yml
--- a/.github/workflows/dotnet.yml
+++ b/.github/workflows/dotnet.yml
@@ -7,6 +7,9 @@
   pull_request:
     branches: [ "main" ]
 
+permissions:
+  contents: read
+
 jobs:
   build:
     name: Build and analyze
EOF
@@ -7,6 +7,9 @@
pull_request:
branches: [ "main" ]

permissions:
contents: read

jobs:
build:
name: Build and analyze
Copilot is powered by AI and may make mistakes. Always verify output.
32 changes: 32 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: 🚀 Publish NuGet Package

on:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: 🧾 Checkout code
uses: actions/checkout@v4

- name: 🛠 Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.x'

- name: 🔍 Restore dependencies
run: dotnet restore

- name: 🛠 Build solution
run: dotnet build --configuration Release

- name: 📦 Pack NuGet package for ${{ github.event.repository.name }}
run: dotnet pack ./src/**/*.csproj --configuration Release --output ./nupkg

- name: 🚀 Publish to NuGet.org
run: dotnet nuget push ./nupkg/*.nupkg --skip-duplicate --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NuGet_API_Key }} #

13 changes: 13 additions & 0 deletions .idea/.idea.AStar.Dev.Infrastructure.FilesDb/.idea/.gitignore

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

1 change: 1 addition & 0 deletions .idea/.idea.AStar.Dev.Infrastructure.FilesDb/.idea/.name

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

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

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

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

4 changes: 4 additions & 0 deletions .idea/.idea.AStar.Dev.Infrastructure.FilesDb/.idea/misc.xml

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

13 changes: 13 additions & 0 deletions .idea/.idea.AStar.Dev.Infrastructure.FilesDb/.idea/vcs.xml

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

57 changes: 0 additions & 57 deletions AStar.Dev.Example.sln.sln

This file was deleted.

19 changes: 19 additions & 0 deletions AStar.Dev.Infrastructure.FilesDb.slnx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Solution>
<Folder Name="/Solution Items/">
<File Path=".editorconfig"/>
<File Path=".gitignore"/>
<File Path="build-and-test.ps1"/>
<File Path="CodeMaid.config"/>
<File Path="LICENSE"/>
<File Path="nuget.ci.config"/>
<File Path="nuget.config"/>
<File Path="README.md"/>
</Folder>
<Folder Name="/src/">
<Project Path="src\AStar.Dev.Infrastructure.FilesDb\AStar.Dev.Infrastructure.FilesDb.csproj" Type="Classic C#"/>
</Folder>
<Folder Name="/test/"/>
<Folder Name="/test/unit/">
<Project Path="test\AStar.Dev.Infrastructure.FilesDb.Tests.Unit\AStar.Dev.Infrastructure.FilesDb.Tests.Unit.csproj" Type="Classic C#"/>
</Folder>
</Solution>
82 changes: 0 additions & 82 deletions CodeMaid.config

This file was deleted.

Binary file added astar.ico
Binary file not shown.
Binary file added astar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 0 additions & 5 deletions nuget.ci.config

This file was deleted.

6 changes: 0 additions & 6 deletions nuget.config

This file was deleted.

This file was deleted.

6 changes: 0 additions & 6 deletions src/AStar.Dev.Example.ClassLib/Class1.cs

This file was deleted.

Loading
Loading