Hi, how are you?
I'm just starting with Google Cloud, so I don't have much knowledge about the practices used here. I would like to ask for help regarding how I should proceed with a project.
Introducing...
I have recently received some requests for spreadsheet automation, and they all follow the same pattern. Unfortunately, the only barrier to continuing all these projects at the moment is the integration between the Google Sheets API, a Python application, and GitHub Actions. GitHub Actions is used to remotely activate the application at scheduled intervals in a virtual environment within GitHub, which accesses Google Sheets and performs the necessary manipulations.
I'm not sure if this is the appropriate place to discuss this, but since it involves the Google Sheets API, I thought it could help future developers.
Problem...
Following the guide for integrating with the Google Sheets API (https://developers.google.com/sheets/api/quickstart/python?hl=en), whenever the application runs, it makes requests using the data stored in either the credentials.json or token.json file.
My problem is how I can pass these variables to the execution environment of GitHub Actions workflows in an intelligent and dynamic way. The contents of these files are not just simple variables but a series of data. Additionally, the token is updated periodically, so I can't dynamically change the secrets of GitHub Environments directly from the code, which goes against the idea of automation.
So, for those of you who have probably encountered something similar, how can I handle tokens and credentials appropriately, dynamically, and securely in a GitHub Actions environment?
Thank you in advance for your attention. Have a great day! 😄
Solved! Go to Solution.
I found a really simple way to do it, you can find it in this GitHub repository.
The docs in README teach many ways to make it using the
from google.oauth2 import service_account
self.__credentials = service_account.Credentials.from_service_account_info()
I found a really simple way to do it, you can find it in this GitHub repository.
The docs in README teach many ways to make it using the
from google.oauth2 import service_account
self.__credentials = service_account.Credentials.from_service_account_info()