Skip to content

Commit

Permalink
merge from main
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveSkender committed Jan 5, 2024
2 parents 99f4079 + 2c3bb50 commit 531ce8b
Show file tree
Hide file tree
Showing 10 changed files with 117 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/build.main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
tokenSuffix: __

- task: UseDotNet@2
displayName: Install .NET SDK
displayName: Use .Net SDK
continueOnError: True
inputs:
version: 8.x
Expand Down
70 changes: 70 additions & 0 deletions .github/workflows/semantic-pr-linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: "Lint PR"

on:
pull_request_target:
types:
- opened
- edited
- synchronize

permissions:
pull-requests: write

jobs:
main:
name: validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
id: lint_pr_title
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:

# Configure additional validation for the subject based on a regex.
# We enforce that the subject starts with an uppercase character.
subjectPattern: ^([A-Z]).+$

# If `subjectPattern` is configured, you can use this property to override
# the default error message that is shown when the pattern doesn't match.
# The variables `subject` and `title` can be used within the message.
subjectPatternError: >
The subject "**{subject}**" found in the pull request title "*{title}*"
didn't match the configured pattern. Please ensure that the subject
starts with an uppercase character.
# If the PR contains one of these newline-delimited labels, the
# validation is skipped. If you want to rerun the validation when
# labels change, you might want to use the `labeled` and `unlabeled`
# event triggers in your workflow.
ignoreLabels: |
bot
ignore-semantic-pull-request
- uses: marocchino/sticky-pull-request-comment@v2
# When the previous steps fails, the workflow would stop. By adding this
# condition you can continue the execution with the populated error message.
if: always() && (steps.lint_pr_title.outputs.error_message != null)
with:
header: pr-title-lint-error
message: >
### Hey there and thank you for opening this pull request! 👋🏼
It looks like your proposed **_Pull request title_** needs to be adjusted.
>🚩 **Error** » ${{ steps.lint_pr_title.outputs.error_message }}
#### Pull request title naming convention
Our PR title name taxonomy is `type: Subject`, where **type** is typically
*feat*, *fix*, or *chore*, and **subject** is a phrase (proper noun) that starts with a capitalized letter.
The *chore* type usually has a subject that starts with an action verb like *Add* or *Update*.
Examples: `feat: Admin portal login`, `fix: Divide by zero bug in SMA`, and `chore: Update user docs`.
See the [Conventional Commits specification](https://www.conventionalcommits.org) for more information.
# Delete a previous comment when the issue has been resolved
- if: ${{ steps.lint_pr_title.outputs.error_message == null }}
uses: marocchino/sticky-pull-request-comment@v2
with:
header: pr-title-lint-error
delete: true
3 changes: 2 additions & 1 deletion Client/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@
"cli": {
"schematicCollections": [
"@angular-eslint/schematics"
]
],
"analytics": false
},
"schematics": {
"@angular-eslint/schematics:application": {
Expand Down
2 changes: 1 addition & 1 deletion Server/ChartBackend.sln
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
..\README.md = ..\README.md
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Functions", "Functions\Functions.csproj", "{5C774F35-FFB4-488A-8232-8D31F77557A7}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Functions", "Functions\Functions.csproj", "{5C774F35-FFB4-488A-8232-8D31F77557A7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
2 changes: 1 addition & 1 deletion Server/Functions/Functions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@
<ItemGroup>
<Using Include="System.Threading.ExecutionContext" Alias="ExecutionContext" />
</ItemGroup>
</Project>
</Project>
2 changes: 1 addition & 1 deletion Server/Functions/GlobalSuppressions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file is used by Code Analysis to maintain SuppressMessage
// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.
Expand Down
5 changes: 5 additions & 0 deletions Server/WebApi/Program.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// STARTUP CONFIGURATION

using WebApi.Services;

WebApplicationBuilder builder = WebApplication.CreateBuilder(args);

IServiceCollection services = builder.Services;
Expand Down Expand Up @@ -28,6 +30,9 @@

Console.WriteLine($"CORS Origins: {corsOrigins["Website"]}");

// register services
builder.Services.AddHostedService<StartupService>();

// build application
WebApplication app = builder.Build();

Expand Down
17 changes: 15 additions & 2 deletions Server/WebApi/Services/Service.Storage.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Text;
using Azure;
using Azure.Storage.Blobs;
using Azure.Storage.Blobs.Models;

Expand All @@ -7,14 +8,26 @@ namespace WebApi.Services;
public static class Storage
{
// STARTUP
public static void Startup()
public static async Task Startup(CancellationToken cancellationToken)
{
// initialize Azure services (setup storage)
string awjsConnection = Environment.GetEnvironmentVariable("AzureWebJobsStorage");

// main blob container
BlobContainerClient blobContainer = new(awjsConnection, "chart-demo");
blobContainer.CreateIfNotExists();

Response<BlobContainerInfo> response = await blobContainer
.CreateIfNotExistsAsync(cancellationToken: cancellationToken);

// when new container
if (response != null)
{
Console.WriteLine($"NOTE: New blob container `chart-demo` created {response.Value}.");
}
else
{
Console.WriteLine($"NOTE: Blob container already exists.");
}
}

// SAVE BLOB
Expand Down
20 changes: 20 additions & 0 deletions Server/WebApi/Startup.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
namespace WebApi.Services;

public class StartupService : IHostedService
{
public async Task StartAsync(CancellationToken cancellationToken)
{
// The code in here will run when the application starts,
// and block the startup process until finished

await Storage.Startup(cancellationToken);
}

public Task StopAsync(CancellationToken cancellationToken)
{
// The code in here will run when the application stops
// In your case, nothing to do

return Task.CompletedTask;
}
}
2 changes: 1 addition & 1 deletion Server/WebApi/WebApi.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<Title>charts.stockindicators.dev</Title>
Expand Down

0 comments on commit 531ce8b

Please sign in to comment.