Skip to content

Conversation

@aditigopalan
Copy link
Contributor

@aditigopalan aditigopalan commented Jan 28, 2025

Fixes #97

This GitHub Action automates the process of syncing a specified Google Sheet to a GitHub repository as a CSV file, facilitating RFC integration.

Key Features:

  1. Daily Automation: Runs on a schedule (cron) or can be triggered manually.
  2. Customizable Inputs:
    • spreadsheet_id: The Google Sheet ID to monitor.
    • stop_day and stop_time: Defines when the action should stop execution.
  3. Branch and PR Management:
    • Creates a branch named RFC-{GoogleSheetName}.
    • Stores the CSV as RFC_DATA/{GoogleSheetName}.csv.
    • Ensures a single pull request (PR) for the branch, reusing it for subsequent changes.
  4. Secure Credentials:
    • Uses RFC_TOKEN (Personal Access Token) and GOOGLE_CREDENTIALS stored securely as GitHub Secrets.

Workflow:

  1. Checks for changes in the Google Sheet.
  2. Updates the CSV file in the RFC_DATA folder on the corresponding branch.
  3. Updates or creates a pull request for the branch.

Script is tested and RFC Integration works, but test on actual action pending merge

Note: I used Google credentials from HTAN. Does MC2 have a google service account? If so those credentials should be updated.

The end result will look something like #164

@aditigopalan aditigopalan requested a review from vpchung as a code owner January 28, 2025 21:42
@aditigopalan aditigopalan added priority-high major PR label for a major update and removed priority-high labels Jan 28, 2025
Copy link
Member

@vpchung vpchung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

I just have some nitpicks 🙃

@aditigopalan aditigopalan requested a review from vpchung February 4, 2025 17:59
@aditigopalan
Copy link
Contributor Author

LGTM.

I just have some nitpicks 🙃

Thank you so much! Let me know if the fixes make sense :)

@aditigopalan aditigopalan requested a review from vpchung February 13, 2025 18:51
@aditigopalan aditigopalan requested a review from Bankso March 5, 2025 15:04
Copy link
Member

@vpchung vpchung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gosh, so sorry I missed this code review request.

Looks good to me!

Comment on lines +5 to +6
from google.oauth2.service_account import Credentials
from googleapiclient.discovery import build
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if you'd find the effort to switch over worth it, but I really like using gspread library to access and edit Google spreadsheets!

It could make some of the functions below a bit more readable and easier to comprehend right away.

Comment on lines +35 to +39
- name: Create Google Credentials File
env:
GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }}
run: |
echo "${GOOGLE_CREDENTIALS}" > google-credentials.json
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before merging, let's double-check that this step does not write the credentials to the Action logs. I'm 99.9% sure it won't print to the logs since it's a secret, but better safe than sorry 😅

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK just verified that it does not - we good!

Pulling changes from main
@aditigopalan aditigopalan merged commit cc3de5f into main Aug 14, 2025
1 check passed
@aditigopalan aditigopalan deleted the feat-add-sync-action branch August 14, 2025 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

major PR label for a major update

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RFC schedule and deployment plan

4 participants