Parse unread emails from Google Scholar alerts and update README.md.
-
Enable Gmail API and Download Credentials
-
Go to Google Cloud Console
-
Create a new project (or select an existing one).
-
Navigate to APIs & Services → Library, search for Gmail API, and enable it.
-
Go to APIs & Services → Credentials → Create Credentials → OAuth Client ID.
-
Application type: Desktop app.
-
Download the generated credentials.json file and place it in the project root.
-
Example structure:
. ├── credentials.jsonExample
credentials.json:{ "installed": { "client_id": "YOUR_CLIENT_ID", "project_id": "YOUR_PROJECT_ID", "auth_uri": "https://accounts.google.com/o/oauth2/auth", "token_uri": "https://oauth2.googleapis.com/token", "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", "client_secret": "YOUR_CLIENT_SECRET", "redirect_uris": [ "http://localhost" ] } } -
-
Configure OAuth Consent Screen (In Production)
- In Google Cloud Console, go to APIs & Services → OAuth consent screen.
- Choose External as the user type.
- Fill in all required fields: App name, User support email, Authorized domains, Developer contact info.\
- In the Scopes section, add: https://mail.google.com/, https://www.googleapis.com/auth/gmail.readonly
- Skip the Test users section.
- In the Publishing status section, click Publish App
-
Run
script.sh:bash script.shFor the first run, you will need to log in to your Google account. Ensure that your Gmail account is added as a test user for your app. Refer to this Stack Overflow post for guidance.
This will create a
./data/token.jsonfile. -
Copy the information from
token.jsoninto a GitHub Action secret variable namedTOKEN_CONFIG_JSON.Example
token.json:{ "token": "YOUR_ACCESS_TOKEN", "refresh_token": "YOUR_REFRESH_TOKEN", "token_uri": "https://oauth2.googleapis.com/token", "client_id": "YOUR_CLIENT_ID", "client_secret": "YOUR_CLIENT_SECRET", "scopes": [ "https://mail.google.com/", "https://www.googleapis.com/auth/gmail.readonly" ], "universe_domain": "googleapis.com", "account": "", "expiry": "YOUR_EXPIRY_DATE" }
Run the following command from your CLI:
bash script.sh