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

Update changelog using fresh changelog file from master #534

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions .github/workflows/update_source_data_schema_changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,16 @@ jobs:
set -x
cd $GITHUB_WORKSPACE
OLD_SCHEMAS_DIR=original_schemas
OLD_CHANGELOG_FILEPATH=original_changelog.md
git clone --branch master https://github.com/stellar/stellar-etl-airflow.git repo_master_copy
mkdir OLD_SCHEMAS_DIR
cp -r repo_master_copy/schemas/ $OLD_SCHEMAS_DIR/
cp repo_master_copy/changelog/source_data.md $OLD_CHANGELOG_FILEPATH
export OLD_SCHEMAS_DIR
export OLD_CHANGELOG_FILEPATH
python3 scripts/update_source_data_schema_changelog.py
rm -rf $OLD_SCHEMAS_DIR
rm $OLD_CHANGELOG_FILEPATH
rm -rf repo_master_copy

- name: Commit and Push Changes
Expand Down
6 changes: 5 additions & 1 deletion scripts/update_source_data_schema_changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from datetime import datetime

OLD_SCHEMAS_DIR = os.environ.get("OLD_SCHEMAS_DIR")
OLD_CHANGELOG_FILEPATH = os.environ.get("OLD_CHANGELOG_FILEPATH")
NEW_SCHEMAS_DIR = "schemas"
CHANGELOG_FILEPATH = "changelog/source_data.md"

Expand Down Expand Up @@ -173,7 +174,7 @@ def generate_changelog(schemas_added=[], schemas_deleted=[], schemas_changes={})


def main():
existing_changelog = read_file(filepath=CHANGELOG_FILEPATH)
existing_changelog = read_file(filepath=OLD_CHANGELOG_FILEPATH)
old_schema_filepaths = list_files_in_dir(directory=OLD_SCHEMAS_DIR)
new_schema_filepaths = list_files_in_dir(directory=NEW_SCHEMAS_DIR)

Expand All @@ -191,6 +192,9 @@ def main():
filepath=CHANGELOG_FILEPATH, mode="w", content=new_changelog + "\n\n"
)
write_file(filepath=CHANGELOG_FILEPATH, mode="a", content=existing_changelog)
else:
# Rewrite the changelog since intermediate commits may have overwritten changelog
write_file(filepath=CHANGELOG_FILEPATH, mode="w", content=existing_changelog)


if __name__ == "__main__":
Expand Down