def main():
    global send_reminder_chat
    global lag_reminder_modules
    update_lang_version()

    updated_readme = get_updated_readme()

    # Write to local README file
    f = open(README_FILE, 'w')
    f.write(updated_readme)
    f.close()

    try:
        update_readme, commit = utils.commit_file(
            'ballerina-release', README_FILE, updated_readme,
            constants.DASHBOARD_UPDATE_BRANCH,
            '[Automated] Update extension dependency dashboard')
    except GithubException as e:
        print('Error occurred while committing README.md', e)
        sys.exit(1)

    try:
        image = Image.open(constants.PIE_CHART_IMAGE, mode='r')
        img_byte_arr = io.BytesIO()
        image.save(img_byte_arr, format='JPEG')

        if update_readme:
            utils.commit_image_file('ballerina-release',
                                    constants.PIE_CHART_IMAGE,
                                    img_byte_arr.getvalue(),
                                    constants.DASHBOARD_UPDATE_BRANCH,
                                    '[Automated] Update status pie chart')

    except GithubException as e:
        print('Error occurred while committing status pie chart', e)
        sys.exit(1)

    if update_readme:
        utils.open_pr_and_merge(
            'ballerina-release',
            '[Automated] Update Extension Dependency Dashboard',
            'Update extension dependency dashboard',
            constants.DASHBOARD_UPDATE_BRANCH)
        if send_reminder_chat == 'true' and len(lag_reminder_modules) > 0:
            chat_message = distribution_lag_statement.replace(
                '<code>ballerina-distribution</code>',
                '*ballerina-distribution*') + ".\n\n"
            chat_message += "*Reminder* on the following modules\' dependency update..." + "\n"
            for module in lag_reminder_modules:
                lag_status_link = module[MODULE_PULL_REQUEST]
                if lag_status_link == "":
                    lag_status_link = constants.BALLERINA_ORG_URL + module[
                        MODULE_NAME]
                chat_message += utils.get_module_message(
                    module, lag_status_link)
            print("\n" + utils.get_sanitised_chat_message(chat_message))
            notify_chat.send_message(chat_message)
    else:
        print('No changes to ' + README_FILE + ' file')
def main():
    global send_reminder_chat
    global lag_reminder_modules
    update_lang_version()

    updated_readme = get_updated_readme()

    # Write to local README file
    f = open(README_FILE, 'w')
    f.write(updated_readme)
    f.close()

    try:
        update_readme, commit = utils.commit_file('ballerina-release',
                                                  README_FILE, updated_readme,
                                                  constants.DASHBOARD_UPDATE_BRANCH,
                                                  '[Automated] Update extension dependency dashboard')
    except GithubException as e:
        print('Error occurred while committing README.md', e)
        sys.exit(1)

    try:
        image = Image.open(constants.PIE_CHART_IMAGE, mode='r')
        img_byte_arr = io.BytesIO()
        image.save(img_byte_arr, format='JPEG')

        if update_readme:
            utils.commit_image_file('ballerina-release', constants.PIE_CHART_IMAGE, img_byte_arr.getvalue(),
                                    constants.DASHBOARD_UPDATE_BRANCH, '[Automated] Update status pie chart')

    except GithubException as e:
        print('Error occurred while committing status pie chart', e)
        sys.exit(1)

    if update_readme:
        utils.open_pr_and_merge('ballerina-release',
                                '[Automated] Update Extension Dependency Dashboard',
                                'Update extension dependency dashboard',
                                constants.DASHBOARD_UPDATE_BRANCH)
        if send_reminder_chat == 'true':
            notify_chat.send_reminder(lag_reminder_modules)

    else:
        print('No changes to ' + README_FILE + ' file')