Skip to content

Commit

Permalink
Merge pull request #11601 from archesproject/jtw/follow-up-system-check
Browse files Browse the repository at this point in the history
Automate the changes to the github action template re #10079
  • Loading branch information
chrabyrd authored Nov 2, 2024
2 parents 7289bd3 + d4eca51 commit 524c52c
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions arches/management/commands/updateproject.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,30 @@ def update_to_v8(self):
os.remove(declarations_test_file_path)

self.stdout.write("Done!")

# Update certain lines in GitHub Actions workflows.
self.stdout.write("Updating GitHub Actions...")
action_path = os.path.join(
settings.APP_ROOT,
"..",
".github",
"actions",
"build-and-test-branch",
"action.yml",
)
if os.path.exists(action_path):
first_find = "python manage.py check\n"
first_replace = "python manage.py check --tag=compatibility\n"
second_find = "python manage.py makemigrations --check\n"
second_replace = "python manage.py makemigrations --check --skip-checks\n"
with open(action_path, "r") as f:
content = f.readlines()
for i, line in enumerate(content):
if line.endswith(first_find):
content[i] = line.replace(first_find, first_replace)
elif line.endswith(second_find):
content[i] = line.replace(second_find, second_replace)
with open(action_path, "w") as f:
f.writelines(content)

self.stdout.write("Done!")

0 comments on commit 524c52c

Please sign in to comment.