Skip to content

Commit

Permalink
update token read and a list of labels and printed a done message
Browse files Browse the repository at this point in the history
  • Loading branch information
TerryMcGuinness-NOAA committed Sep 18, 2023
1 parent 8447656 commit cabb84e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions ci/scripts/weekly_tests.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
#! /usr/bin/env python3

import time
from pathlib import Path
from github import Github
from datetime import datetime
from pathlib import Path

now = datetime.now()
date = now.strftime("%m %d %Y")

# Provide your personal access token or use a GitHub token if available

with open(Path.home().joinpath('.gittokens','access_token.txt'), 'r') as file:
access_token = file.read().strip()

# Create a PyGitHub instance using the access token
githue = Github(access_token)
github = Github(access_token)

# Specify the repository where you want to open the Pull Request and modify the label
repo_owner = 'TerrenceMcGuinness-NOAA'
repo_name = 'global-workflow'
pr_title = 'Weekly Tests '+date
pr_body = 'Weekly High Resolution Forecast Tests'
label_name = 'CI-Hera-Ready'
label_names = ['CI-Hera-Ready','CI-Orion-Ready']

# Get the repository object
repo = github.get_repo(f'{repo_owner}/{repo_name}')
Expand All @@ -33,8 +32,6 @@
time.sleep(5)
branch = repo.get_branch(branch_name)

#pr_cases = repo.get_dir_contents(_top+'ci/cases/pr')
print('/ci/cases/pr')
pr_cases = repo.get_contents('/ci/cases/pr', ref=branch.name)
for file in pr_cases:
if file.name.endswith('.yaml'):
Expand All @@ -52,5 +49,8 @@
# Create a new Pull Request
pr = repo.create_pull(title=pr_title, body=pr_body, head='weekly_tests', base='develop')

# Add label to the Pull Request
pr.add_to_labels(label_name)
# Add labels to the Pull Request
for label_name in label_names:
pr.add_to_labels(label_name)

print(f'Pull Request {pr_title} successfully created')

0 comments on commit cabb84e

Please sign in to comment.