Skip to content

Commit

Permalink
feat: Reworked.
Browse files Browse the repository at this point in the history
  • Loading branch information
HavenDV committed Aug 24, 2024
1 parent e11ab18 commit 5ae241b
Show file tree
Hide file tree
Showing 265 changed files with 18,760 additions and 309 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Auto-approve and auto-merge bot pull requests
on:
pull_request:
branches:
- main

permissions:
contents: write
pull-requests: write

jobs:
auto-merge:
runs-on: ubuntu-latest
if: ${{ (github.actor == 'dependabot[bot]' || github.actor == 'HavenDV') && github.repository_owner == 'tryAGI' }}
steps:
- name: Dependabot metadata
if: ${{ github.actor == 'dependabot[bot]' }}
id: metadata
uses: dependabot/fetch-metadata@0fb21704c18a42ce5aa8d720ea4b912f5e6babef
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

- name: Show sender
run: echo ${{ github.event.pull_request.sender }}

- name: Show triggering_actor
run: echo ${{ github.triggering_actor }}

- name: Approve a PR
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Enable auto-merge
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63 changes: 63 additions & 0 deletions .github/workflows/auto-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Opens a new PR if there are OpenAPI updates
on:
schedule:
- cron: '0 */3 * * *'

permissions:
contents: write
pull-requests: write
actions: write

jobs:
check-openapi-updates:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Git user
run: |
git config --local user.email "bot@openai.com"
git config --local user.name "github-actions[bot]"
- name: Generate branch name
id: branch
run: echo "branch_name=bot/update-openapi_$(date +'%Y%m%d%H%M')" >> $GITHUB_OUTPUT

- name: Create branch
run: |
git checkout -b ${{ steps.branch.outputs.branch_name }} origin/main
git rebase main
- name: Generate code
run: |
cd src/libs/Leonardo
chmod +x ./generate.sh
./generate.sh
- name: Check for changes
id: changes
run: |
CHANGED=$(git diff --name-only)
if [ -z "$CHANGED" ]; then
echo "has_changes=false" >> $GITHUB_OUTPUT
else
echo "has_changes=true" >> $GITHUB_OUTPUT
fi
- name: Push changes
if: steps.changes.outputs.has_changes == 'true'
run: |
git add .
git commit -m "feat: Updated OpenAPI spec"
git push --force-with-lease -u origin ${{ steps.branch.outputs.branch_name }}
- name: Wait for 15 seconds
if: steps.changes.outputs.has_changes == 'true'
run: sleep 15

- name: Create pull request
if: steps.changes.outputs.has_changes == 'true'
run: gh pr create -B main -H ${{ steps.branch.outputs.branch_name }} --title 'feat:@coderabbitai' --body '@coderabbitai summary'
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
30 changes: 26 additions & 4 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,38 @@
name: Build, test and publish
name: Publish
on:
push:
branches:
- main
tags:
- v*

permissions:
contents: write

jobs:
build-test-publish:
name: Build, test and publish
publish:
name: Publish
uses: HavenDV/workflows/.github/workflows/dotnet_build-test-publish.yml@main
with:
generate-build-number: false
conventional-commits-publish-conditions: false
enable-caching: false
additional-test-arguments: '--logger GitHubActions'
secrets:
nuget-key: ${{ secrets.NUGET_KEY }}
nuget-key: ${{ secrets.NUGET_KEY }}

release:
name: Release
runs-on: ubuntu-latest
needs: [publish]
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Create release
run: gh release create ${{ github.ref_name }}
--title "${{ github.ref_name }}"
--generate-notes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56 changes: 56 additions & 0 deletions .github/workflows/mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: MKDocs Deploy
on:
push:
branches:
- main
paths:
- 'docs/**'
- 'mkdocs.yml'
- 'examples/**'
- 'src/helpers/GenerateDocs/**'
- '.github/workflows/mkdocs.yml'

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Pages
uses: actions/configure-pages@v5

- name: Install dependencies
run: pip install mkdocs-material

- name: Generate docs
run: dotnet run --project src/helpers/GenerateDocs/GenerateDocs.csproj .

- name: Build with MkDocs
run: mkdocs build -d ./_site

- name: Upload artifact
uses: actions/upload-pages-artifact@v3

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
4 changes: 2 additions & 2 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: Build and test
name: Test
on:
pull_request:
branches:
- main

jobs:
build-test:
test:
name: Build abd test
uses: HavenDV/workflows/.github/workflows/dotnet_build-test-publish.yml@main
with:
Expand Down
79 changes: 79 additions & 0 deletions Leonardo.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30204.135
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{E793AF18-4371-4EBD-96FC-195EB1798855}"
ProjectSection(SolutionItems) = preProject
.gitignore = .gitignore
src\Directory.Build.props = src\Directory.Build.props
.github\workflows\dotnet.yml = .github\workflows\dotnet.yml
LICENSE = LICENSE
README.md = README.md
docs\openapi.json = docs\openapi.json
.github\workflows\pull-request.yml = .github\workflows\pull-request.yml
.github\workflows\auto-merge.yml = .github\workflows\auto-merge.yml
.github\workflows\auto-update.yml = .github\workflows\auto-update.yml
.github\workflows\mkdocs.yml = .github\workflows\mkdocs.yml
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libs", "libs", "{61E7E11E-4558-434C-ACE8-06316A3097B3}"
ProjectSection(SolutionItems) = preProject
src\libs\Directory.Build.props = src\libs\Directory.Build.props
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{AAA11B78-2764-4520-A97E-46AA7089A588}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Leonardo", "src\libs\Leonardo\Leonardo.csproj", "{F594D1DB-8F30-4D1C-A398-F069F6B77E4D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Leonardo.IntegrationTests", "src\tests\Leonardo.IntegrationTests\Leonardo.IntegrationTests.csproj", "{C65DB2A3-EFAD-4C6D-9315-9478506EEBB5}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "helpers", "helpers", "{37606C60-C270-4C55-B9BC-EFF8E70761B6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TrimmingHelper", "src\helpers\TrimmingHelper\TrimmingHelper.csproj", "{9C53E5EA-AE79-40F3-9121-03ABA46228DB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FixOpenApiSpec", "src\helpers\FixOpenApiSpec\FixOpenApiSpec.csproj", "{5B842483-A5CF-436F-A5A1-D2C2EB6EE6C9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GenerateDocs", "src\helpers\GenerateDocs\GenerateDocs.csproj", "{5182C7D1-86B9-48DF-87AE-C03F362937A9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F594D1DB-8F30-4D1C-A398-F069F6B77E4D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F594D1DB-8F30-4D1C-A398-F069F6B77E4D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F594D1DB-8F30-4D1C-A398-F069F6B77E4D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F594D1DB-8F30-4D1C-A398-F069F6B77E4D}.Release|Any CPU.Build.0 = Release|Any CPU
{C65DB2A3-EFAD-4C6D-9315-9478506EEBB5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C65DB2A3-EFAD-4C6D-9315-9478506EEBB5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C65DB2A3-EFAD-4C6D-9315-9478506EEBB5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C65DB2A3-EFAD-4C6D-9315-9478506EEBB5}.Release|Any CPU.Build.0 = Release|Any CPU
{9C53E5EA-AE79-40F3-9121-03ABA46228DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9C53E5EA-AE79-40F3-9121-03ABA46228DB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9C53E5EA-AE79-40F3-9121-03ABA46228DB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9C53E5EA-AE79-40F3-9121-03ABA46228DB}.Release|Any CPU.Build.0 = Release|Any CPU
{5B842483-A5CF-436F-A5A1-D2C2EB6EE6C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5B842483-A5CF-436F-A5A1-D2C2EB6EE6C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5B842483-A5CF-436F-A5A1-D2C2EB6EE6C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5B842483-A5CF-436F-A5A1-D2C2EB6EE6C9}.Release|Any CPU.Build.0 = Release|Any CPU
{5182C7D1-86B9-48DF-87AE-C03F362937A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5182C7D1-86B9-48DF-87AE-C03F362937A9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5182C7D1-86B9-48DF-87AE-C03F362937A9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5182C7D1-86B9-48DF-87AE-C03F362937A9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{F594D1DB-8F30-4D1C-A398-F069F6B77E4D} = {61E7E11E-4558-434C-ACE8-06316A3097B3}
{C65DB2A3-EFAD-4C6D-9315-9478506EEBB5} = {AAA11B78-2764-4520-A97E-46AA7089A588}
{9C53E5EA-AE79-40F3-9121-03ABA46228DB} = {37606C60-C270-4C55-B9BC-EFF8E70761B6}
{5B842483-A5CF-436F-A5A1-D2C2EB6EE6C9} = {37606C60-C270-4C55-B9BC-EFF8E70761B6}
{5182C7D1-86B9-48DF-87AE-C03F362937A9} = {37606C60-C270-4C55-B9BC-EFF8E70761B6}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {CED9A020-DBA5-4BE6-8096-75E528648EC1}
EndGlobalSection
EndGlobal
54 changes: 0 additions & 54 deletions LeonardoAi.sln

This file was deleted.

Loading

0 comments on commit 5ae241b

Please sign in to comment.