-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix EDDF url
- Loading branch information
Showing
3 changed files
with
36 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,37 @@ | ||
import os | ||
import sys | ||
import requests | ||
from settings import ROOT_DIRECTORY, OUTPUT_DIRECTORY | ||
from tasks.toml_data import TomlData | ||
|
||
|
||
if __name__ == "__main__": | ||
TomlData(data_dir=ROOT_DIRECTORY, output_dir=OUTPUT_DIRECTORY, export=False) | ||
tomldata = TomlData( | ||
data_dir=ROOT_DIRECTORY, output_dir=OUTPUT_DIRECTORY, export=False | ||
) | ||
|
||
if len(tomldata.errors) == 0: | ||
sys.exit(0) | ||
|
||
GITHUB_TOKEN = os.getenv("GITHUB_TOKEN") | ||
REPO_OWNER = os.getenv("REPO_OWNER") | ||
REPO_NAME = os.getenv("REPO_NAME") | ||
workflow_run_number = os.getenv("WORKFLOW_RUN_NUMBER") | ||
|
||
issue_title = f"Error on workflow run {workflow_run_number}" | ||
issue_body = "\n".join(tomldata.errors) | ||
|
||
url = f"https://api.github.com/repos/{REPO_OWNER}/{REPO_NAME}/issues" | ||
headers = { | ||
"Authorization": f"token {GITHUB_TOKEN}", | ||
"Accept": "application/vnd.github.v3+json", | ||
} | ||
data = {"title": issue_title, "body": issue_body} | ||
|
||
response = requests.post(url, json=data, headers=headers, timeout=5) | ||
|
||
if response.status_code == 201: | ||
print("Issue created successfully.") | ||
else: | ||
print(f"Failed to create issue: {response.status_code}") | ||
print(response.json()) |