Merge pull request #1850 from zed-industries/add-automatic-annotations-for-mixpanel
Add automatic annotations for mixpanel
This commit is contained in:
parent
81959eac51
commit
fcbef6343e
3 changed files with 47 additions and 0 deletions
16
.github/workflows/release_actions.yml
vendored
16
.github/workflows/release_actions.yml
vendored
|
@ -21,3 +21,19 @@ jobs:
|
||||||
|
|
||||||
${{ github.event.release.body }}
|
${{ github.event.release.body }}
|
||||||
```
|
```
|
||||||
|
mixpanel_release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: "3.10.5"
|
||||||
|
architecture: "x64"
|
||||||
|
cache: "pip"
|
||||||
|
- run: pip install -r script/mixpanel_release/requirements.txt
|
||||||
|
- run: >
|
||||||
|
python script/mixpanel_release/main.py
|
||||||
|
${{ github.event.release.tag_name }}
|
||||||
|
${{ secrets.MIXPANEL_PROJECT_ID }}
|
||||||
|
${{ secrets.MIXPANEL_SERVICE_ACCOUNT_USERNAME }}
|
||||||
|
${{ secrets.MIXPANEL_SERVICE_ACCOUNT_SECRET }}
|
||||||
|
|
30
script/mixpanel_release/main.py
Normal file
30
script/mixpanel_release/main.py
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
import datetime
|
||||||
|
import sys
|
||||||
|
import requests
|
||||||
|
|
||||||
|
def main():
|
||||||
|
version = sys.argv[1]
|
||||||
|
version = version.removeprefix("v")
|
||||||
|
project_id = sys.argv[2]
|
||||||
|
account_username = sys.argv[3]
|
||||||
|
account_secret = sys.argv[4]
|
||||||
|
|
||||||
|
current_datetime = datetime.datetime.now(datetime.timezone.utc)
|
||||||
|
current_datetime = current_datetime.strftime("%Y-%m-%d %H:%M:%S")
|
||||||
|
|
||||||
|
url = f"https://mixpanel.com/api/app/projects/{project_id}/annotations"
|
||||||
|
|
||||||
|
payload = {
|
||||||
|
"date": current_datetime,
|
||||||
|
"description": version
|
||||||
|
}
|
||||||
|
|
||||||
|
response = requests.post(
|
||||||
|
url,
|
||||||
|
auth=(account_username, account_secret),
|
||||||
|
json=payload
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
1
script/mixpanel_release/requirements.txt
Normal file
1
script/mixpanel_release/requirements.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
requests==2.28.1
|
Loading…
Add table
Add a link
Reference in a new issue