Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
seesharprun committed Oct 14, 2024
1 parent e3ac507 commit ca7aff3
Show file tree
Hide file tree
Showing 7 changed files with 195 additions and 2 deletions.
41 changes: 41 additions & 0 deletions .github/SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.9 BLOCK -->

## Security

Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet) and [Xamarin](https://github.com/xamarin).

If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/security.md/definition), please report it to us as described below.

## Reporting Security Issues

**Please do not report security vulnerabilities through public GitHub issues.**

Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/security.md/msrc/create-report).

If you prefer to submit without logging in, send email to [[email protected]](mailto:[email protected]). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/security.md/msrc/pgp).

You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).

Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:

* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
* Full paths of source file(s) related to the manifestation of the issue
* The location of the affected source code (tag/branch/commit or direct URL)
* Any special configuration required to reproduce the issue
* Step-by-step instructions to reproduce the issue
* Proof-of-concept or exploit code (if possible)
* Impact of the issue, including how an attacker might exploit the issue

This information will help us triage your report more quickly.

If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/security.md/msrc/bounty) page for more details about our active programs.

## Preferred Languages

We prefer all communications to be in English.

## Policy

Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/security.md/cvd).

<!-- END MICROSOFT SECURITY.MD BLOCK -->
83 changes: 83 additions & 0 deletions .github/workflows/clone.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Pull latest changes from quickstart repository
on:
workflow_dispatch:
schedule:
- cron: '0 13 * * 1'
jobs:
pull-request-source-repo:
name: Create pull request
runs-on: ubuntu-latest
env:
WORKING_BRANCH: auto
steps:
- name: Get GitHub App token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.PORTAL_QUICKSTART_SYNCHRONIZER_APP_ID }}
private-key: ${{ secrets.PORTAL_QUICKSTART_SYNCHRONIZER_PRIVATE_KEY }}
- name: Checkout source repository
uses: actions/checkout@v4
with:
repository: azure-samples/cosmos-db-table-dotnet-quickstart
ref: main
path: source
- name: Checkout target repository
uses: actions/checkout@v4
with:
token: ${{ steps.app-token.outputs.token }}
ref: ${{ github.head_ref }}
path: target
- name: Get GitHub App User ID
id: get-user-id
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
- name: Configure git
working-directory: target
run: |
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com>'
- name: Generate date variables
run: |
echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
echo "WORKING_BRANCH=auto-$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV
- name: Create working branch
working-directory: target
run: git checkout -b $WORKING_BRANCH
- name: Copy source to target
run: cp -ra source/src/. target/
- name: Change text content
working-directory: target
run: |
content=$(cat .github/workflows/replace.cs)
awk -v content="$content" '
BEGIN { in_block = 0 }
/^\s*\/\/ <create_client>/ { in_block = 1; print content; next }
/^\s*\/\/ <\/create_client>/ { in_block = 0; next }
!in_block { print }
' web/Program.cs > web/Program.tmp.cs && mv web/Program.tmp.cs web/Program.cs
- name: Add changes to git
working-directory: target
run: |
git add .
- name: Check if files are changed
id: check-files
working-directory: target
run: |
echo "status=$(git diff --shortstat --staged)" >> $GITHUB_OUTPUT
- name: Commit and push changes
if: ${{ steps.check-files.outputs.status != '' }}
working-directory: target
run: |
git commit -m "Automatically generated commit"
git push --set-upstream origin $WORKING_BRANCH
- name: Create auto-merge pull request
if: ${{ steps.check-files.outputs.status != '' }}
working-directory: target
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
url=$(gh pr create --title "[AUTO] $CURRENT_DATE | Merge latest from source repo" --body "${{ steps.check-files.outputs.status}}" --base main --head $WORKING_BRANCH)
gh pr merge --auto --merge $url
echo $url
35 changes: 35 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Create release for default branch
on:
workflow_dispatch:
push:
branches:
- main
jobs:
create-release:
name: Create release
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get GitHub App token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.PORTAL_QUICKSTART_SYNCHRONIZER_APP_ID }}
private-key: ${{ secrets.PORTAL_QUICKSTART_SYNCHRONIZER_PRIVATE_KEY }}
- name: Generate output
id: generate
run: |
echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
echo "tag=release-$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT
- name: Create compressed folder
run: |
mkdir out
git archive --format=zip --output out/project.zip main
- name: Push release
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
gh release create ${{ steps.generate.outputs.tag }} \
'out/project.zip#Project folder' \
--title 'Release ${{ steps.generate.outputs.date }}'
7 changes: 7 additions & 0 deletions .github/workflows/replace.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
TableServiceClient serviceClient = new(
connectionString: "<azure-cosmos-db-table-connection-string>"
);

TableClient client = serviceClient.GetTableClient(
tableName: "<table-name>"
);
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) Microsoft Corporation.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE
2 changes: 0 additions & 2 deletions README.md

This file was deleted.

8 changes: 8 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Quickstart - Azure Cosmos DB for Table - .NET

Sample ASP.NET web application using Azure Cosmos DB for NoSQL.

| Task | Link |
| --- | --- |
| Downloaded latest source code | <https://github.com/azurecosmosdb/quickstart-table-dotnet/releases/latest/download/project.zip> |
| Open in GitHub Codespaces | <https://codespaces.new/AzureCosmosDB/quickstart-table-dotnet?template=true&quickstart=1> |

0 comments on commit ca7aff3

Please sign in to comment.