Skip to content

Commit 9cbca06

Browse files
squash!
2 parents d6dcde2 + fd9a816 commit 9cbca06

24 files changed

Lines changed: 5204 additions & 0 deletions

.github/workflows/main.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- master
8+
9+
jobs:
10+
test:
11+
12+
runs-on: ubuntu-18.04
13+
14+
steps:
15+
- uses: actions/checkout@v1
16+
- uses: actions/setup-python@v1
17+
with:
18+
python-version: "3.7"
19+
- uses: actions/cache@v1
20+
with:
21+
path: ~/.cache/pip
22+
key: ${{ runner.os }}-pip-${{ hashFiles('dev-requirements.txt') }}
23+
restore-keys: |
24+
${{ runner.os }}-pip-
25+
- name: Install dev dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
python -m pip install -r dev-requirements.txt
29+
- name: "Run tests"
30+
run: python -m pytest --cov --cov-config=.coveragerc tests/
31+
env:
32+
PYTHONDEVMODE: 1
33+
- run: python -m coverage html
34+
- uses: actions/upload-artifact@v1
35+
with:
36+
name: "HTML coverage report"
37+
path: htmlcov
38+
39+
40+
lint:
41+
42+
runs-on: ubuntu-18.04
43+
44+
steps:
45+
- uses: actions/checkout@v1
46+
- uses: actions/setup-python@v1
47+
with:
48+
python-version: "3.7"
49+
- uses: actions/cache@v1
50+
with:
51+
path: ~/.cache/pip
52+
key: ${{ runner.os }}-pip-${{ hashFiles('dev-requirements.txt') }}
53+
restore-keys: |
54+
${{ runner.os }}-pip-
55+
- name: Install tools
56+
run: |
57+
python -m pip install --upgrade pip
58+
python -m pip install -r dev-requirements.txt
59+
- run: mypy --config-file=mypy.ini __app__
60+
- run: black --check .
61+
62+
63+
deploy:
64+
65+
if: github.event_name == 'push' && github.repository == 'microsoft/pvscbot' && github.ref == 'refs/heads/master'
66+
needs: [test, lint]
67+
runs-on: ubuntu-18.04
68+
env:
69+
APP_LOCATION: __app__
70+
PYTHON_VERSION: "3.7"
71+
72+
steps:
73+
- uses: actions/checkout@v1
74+
- uses: actions/setup-python@v1
75+
with:
76+
python-version: ${{ env.PYTHON_VERSION }}
77+
- uses: actions/cache@v1
78+
with:
79+
path: ~/.cache/pip
80+
key: ${{ runner.os }}-pip-${{ hashFiles('dev-requirements.txt') }}
81+
restore-keys: |
82+
${{ runner.os }}-pip-
83+
- name: 'Run pip'
84+
shell: bash
85+
run: |
86+
# If your function app project is not located in your repository's root
87+
# Please change your directory for pip in pushd
88+
pushd ${{ env.APP_LOCATION }}
89+
python -m pip install --upgrade pip
90+
pip install -r requirements.txt --target=".python_packages/lib/site-packages"
91+
popd
92+
- uses: Azure/functions-action@v1
93+
with:
94+
app-name: pvscbot-functions
95+
package: ${{ env.APP_LOCATION }}
96+
publish-profile: ${{ secrets.SCM_CREDENTIALS }}

README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# Purpose
44

55
This bot exists to automate the development process/workflow for
6+
<<<<<<< HEAD
67
https://github.com/microsoft/vscode-python. It also acts as a simple demo of a
78
GitHub bot running on Azure.
89

@@ -20,6 +21,23 @@ Currently the bot will do the following things for you:
2021

2122
1. Add/remove the `classify` label based on whether any other status label is
2223
set.
24+
=======
25+
https://github.com/microsoft/vscode-python. It also acts as a simple demo of
26+
a GitHub bot running on Azure.
27+
28+
This bot is what is known as an OAuth app and is not a GitHub app. The
29+
[differences](https://developer.github.com/apps/differences-between-apps/) come
30+
down to simplicity in authentication and how widely can the bot be deployed. Since
31+
this bot is only deployed for a single repository and the original author was
32+
intimately familiar with OAuth apps that was the route taken.
33+
34+
This bot also predates [GitHub Actions](https://developer.github.com/actions/)
35+
being released. As such some things this bot does may be easier to do as an action.
36+
37+
Currently the bot will do the following things for you:
38+
39+
1. Add/remove the `classify` label based on whether any other status label is set.
40+
>>>>>>> upstream/master
2341
1. When an issue is closed, remove any status-related labels, e.g. `needs PR`
2442
(with the idea that if an issue is re-opened then it needs to be re-evaluated
2543
as to why the issue is still open).
@@ -32,6 +50,7 @@ Currently the bot will do the following things for you:
3250

3351
You must set two environment variables for the bot to function:
3452

53+
<<<<<<< HEAD
3554
1. `GH_SECRET`:
3655
[secret between GitHub and your bot](https://developer.github.com/webhooks/securing/#setting-your-secret-token).
3756
1. `GH_AUTH`:
@@ -50,6 +69,21 @@ The
5069
is to empower your bot to make changes to your repo on your behalf. You can use
5170
a token from your personal GitHub account or create a fake bot account. Make
5271
sure the token has the following scopes/permissions:
72+
=======
73+
1. `GH_SECRET`: [secret between GitHub and your bot](https://developer.github.com/webhooks/securing/#setting-your-secret-token).
74+
1. `GH_AUTH`: [Auth token](https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line) for the bot to make changes in your repo.
75+
76+
The [shared secret](https://developer.github.com/webhooks/securing/#setting-your-secret-token)
77+
between GitHub and your bot is used to verify that the webhook payload actually
78+
originated from GitHub for your repository and isn't malicious. This is important
79+
as a malicious user could send fake webhook payloads to your bot and cause it to
80+
make changes on the malicious user's behalf.
81+
82+
The [personal access token](https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line)
83+
is to empower your bot to make changes to your repo on your behalf. You can use
84+
a token from your personal GitHub account or create a fake bot account. Make sure
85+
the token has the following scopes/permissions:
86+
>>>>>>> upstream/master
5387
5488
1.`repo:public_repo` (if your repo is public; adjust accordingly for your needs)
5589

@@ -69,6 +103,7 @@ running on Python 3.7.
69103

70104
# Contributing
71105

106+
<<<<<<< HEAD
72107
This project welcomes contributions and suggestions. Most contributions require
73108
you to agree to a Contributor License Agreement (CLA) declaring that you have
74109
the right to, and actually do, grant us the rights to use your contribution. For
@@ -85,3 +120,16 @@ For more information see the
85120
[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
86121
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any
87122
additional questions or comments.
123+
=======
124+
This project welcomes contributions and suggestions. Most contributions require you to agree to a
125+
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
126+
the rights to use your contribution. For details, visit https://cla.microsoft.com.
127+
128+
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide
129+
a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions
130+
provided by the bot. You will only need to do this once across all repos using our CLA.
131+
132+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
133+
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
134+
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
135+
>>>>>>> upstream/master

SECURITY.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.3 BLOCK -->
2+
3+
## Security
4+
5+
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), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).
6+
7+
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets Microsoft's [Microsoft's definition of a security vulnerability](https://docs.microsoft.com/en-us/previous-versions/tn-archive/cc751383(v=technet.10)) of a security vulnerability, please report it to us as described below.
8+
9+
## Reporting Security Issues
10+
11+
**Please do not report security vulnerabilities through public GitHub issues.**
12+
13+
Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://msrc.microsoft.com/create-report).
14+
15+
If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/en-us/msrc/pgp-key-msrc).
16+
17+
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).
18+
19+
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:
20+
21+
* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
22+
* Full paths of source file(s) related to the manifestation of the issue
23+
* The location of the affected source code (tag/branch/commit or direct URL)
24+
* Any special configuration required to reproduce the issue
25+
* Step-by-step instructions to reproduce the issue
26+
* Proof-of-concept or exploit code (if possible)
27+
* Impact of the issue, including how an attacker might exploit the issue
28+
29+
This information will help us triage your report more quickly.
30+
31+
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://microsoft.com/msrc/bounty) page for more details about our active programs.
32+
33+
## Preferred Languages
34+
35+
We prefer all communications to be in English.
36+
37+
## Policy
38+
39+
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://www.microsoft.com/en-us/msrc/cvd).
40+
41+
<!-- END MICROSOFT SECURITY.MD BLOCK -->

__app__/github/function.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
<<<<<<< HEAD
23
"scriptFile": "__init__.py",
34
"bindings": [
45
{
@@ -14,4 +15,23 @@
1415
"name": "$return"
1516
}
1617
]
18+
=======
19+
"scriptFile": "__init__.py",
20+
"bindings": [
21+
{
22+
"authLevel": "function",
23+
"type": "httpTrigger",
24+
"direction": "in",
25+
"name": "req",
26+
"methods": [
27+
"post"
28+
]
29+
},
30+
{
31+
"type": "http",
32+
"direction": "out",
33+
"name": "$return"
34+
}
35+
]
36+
>>>>>>> upstream/master
1737
}

__app__/host.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
{
2+
<<<<<<< HEAD
23
"version": "2.0",
34
"extensionBundle": {
45
"id": "Microsoft.Azure.Functions.ExtensionBundle",
56
"version": "[1.*, 2.0.0)"
67
}
8+
=======
9+
"version": "2.0",
10+
"extensionBundle": {
11+
"id": "Microsoft.Azure.Functions.ExtensionBundle",
12+
"version": "[1.*, 2.0.0)"
13+
}
14+
>>>>>>> upstream/master
715
}

0 commit comments

Comments
 (0)