Add preflight (#490)

* Add preflight

* fix syntax

* move check

* get event

* print

* return event

* use path

* tt

* move to helper

* add issue_comment

* remove should run

* check owner

* add more information to the logs

* test

* add finished

* move keys

* Update errors

* remove repo

* fix JQ run

* filter
This commit is contained in:
Joakim Sørensen
2020-05-28 16:53:45 +02:00
committed by GitHub
parent 51639d6624
commit 9e8788c060
19 changed files with 135 additions and 89 deletions
+6 -15
View File
@@ -1,30 +1,21 @@
import asyncio
import json
import os
from glob import glob
from aiogithubapi import GitHub
from scripts.changed.repo import get_repo
TOKEN = os.getenv("GITHUB_TOKEN")
ACTOR = os.getenv("GITHUB_ACTOR")
from scripts.helpers.event import get_event
async def check():
print("Information: https://hacs.xyz/docs/publish/include#check-owner")
repo = get_repo()
async with GitHub(TOKEN) as github:
repository = await github.get_repo(repo)
repo = repository.attributes
event = get_event()
actor = event["pull_request"]["user"]["login"]
return
# Currently broken. can not use ACTOR
if ACTOR == repo["full_name"].split("/")[0]:
print(f"{ACTOR} is the owner of the repository")
if repo.split("/")[0] == event["pull_request"]["user"]["login"]:
print(f"{actor} is the owner of the repository")
return
exit(78)
print(f"::warning::{actor} is the owner of the repository")
if __name__ == "__main__":