Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

try having combined appfilter in main #2090

Merged
merged 1 commit into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions .github/workflows/combine_appfilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,22 @@
import hashlib
import requests

# Your GitHub token
# Change this to your Repo
Repo = "Arcticons-Team/Arcticons"

# Get the branch name
# Change this to your branch name
branchName = "main"


# Your GitHub token Don't change this
github_token = os.getenv('GITHUB_TOKEN')

# Initialize the GitHub instance
g = Github(github_token)

# Get the repository
repo = g.get_repo("Arcticons-Team/Arcticons")
# Get the repository
repo = g.get_repo(Repo)

def combine_xml_files(input_files, output_file):
unique_components = set()
Expand Down Expand Up @@ -112,7 +120,7 @@ def combine_all_appfilters():

# Try to get the content of the existing combined_appfilter.xml file
try:
existing_file = repo.get_contents('docs/assets/combined_appfilter.xml', ref='icon-requests')
existing_file = repo.get_contents('docs/assets/combined_appfilter.xml', ref=branchName)
print(existing_file) # Debugging statement
if existing_file:
try:
Expand Down Expand Up @@ -149,11 +157,11 @@ def combine_all_appfilters():
try:
if existing_content is None:
# Create the combined_appfilter.xml file in the repository
repo.create_file('docs/assets/combined_appfilter.xml', 'Created combined appfilter.xml from pull requests', new_content, branch='icon-requests')
repo.create_file('docs/assets/combined_appfilter.xml', 'Created combined appfilter.xml from pull requests', new_content, branch=branchName)
print("Created combined_appfilter.xml in the repository.")
else:
# Update the combined_appfilter.xml file in the repository
repo.update_file('docs/assets/combined_appfilter.xml', 'Updated combined appfilter.xml from pull requests', new_content, existing_sha, branch='icon-requests')
repo.update_file('docs/assets/combined_appfilter.xml', 'Updated combined appfilter.xml from pull requests', new_content, existing_sha, branch=branchName)
print("Updated combined_appfilter.xml in the repository.")
except Exception as e:
print(f"Error updating/creating combined_appfilter.xml in the repository: {e}")
Expand Down
Loading