Skip to content
Merged
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
115 changes: 7 additions & 108 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,111 +6,10 @@ updates:
interval: "weekly"
commit-message:
prefix: "chore(deps):"
- package-ecosystem: "npm"
directory: "/adminSDK/directory"
schedule:
interval: "weekly"
commit-message:
prefix: "chore(deps):"
- package-ecosystem: "npm"
directory: "/adminSDK/reports"
schedule:
interval: "weekly"
commit-message:
prefix: "chore(deps):"
- package-ecosystem: "npm"
directory: "/adminSDK/reseller"
schedule:
interval: "weekly"
commit-message:
prefix: "chore(deps):"
- package-ecosystem: "npm"
directory: "/apps-script/quickstart"
schedule:
interval: "weekly"
commit-message:
prefix: "chore(deps):"
- package-ecosystem: "npm"
directory: "/calendar/quickstart"
schedule:
interval: "weekly"
commit-message:
prefix: "chore(deps):"
- package-ecosystem: "npm"
directory: "/classroom/quickstart"
schedule:
interval: "weekly"
commit-message:
prefix: "chore(deps):"
- package-ecosystem: "npm"
directory: "/docs/quickstart"
schedule:
interval: "weekly"
commit-message:
prefix: "chore(deps):"
- package-ecosystem: "npm"
directory: "/drive/activity-v2"
schedule:
interval: "weekly"
commit-message:
prefix: "chore(deps):"
- package-ecosystem: "npm"
directory: "/drive/quickstart"
schedule:
interval: "weekly"
commit-message:
prefix: "chore(deps):"
- package-ecosystem: "npm"
directory: "/drive/snippets"
schedule:
interval: "weekly"
commit-message:
prefix: "chore(deps):"
- package-ecosystem: "npm"
directory: "/forms/snippets"
schedule:
interval: "weekly"
commit-message:
prefix: "chore(deps):"
- package-ecosystem: "npm"
directory: "/gmail/quickstart"
schedule:
interval: "weekly"
commit-message:
prefix: "chore(deps):"
- package-ecosystem: "npm"
directory: "/people/quickstart"
schedule:
interval: "weekly"
commit-message:
prefix: "chore(deps):"
- package-ecosystem: "npm"
directory: "/sheets/quickstart"
schedule:
interval: "weekly"
commit-message:
prefix: "chore(deps):"
- package-ecosystem: "npm"
directory: "/sheets/snippets"
schedule:
interval: "weekly"
commit-message:
prefix: "chore(deps):"
- package-ecosystem: "npm"
directory: "/slides/quickstart"
schedule:
interval: "weekly"
commit-message:
prefix: "chore(deps):"
- package-ecosystem: "npm"
directory: "/slides/snippets"
schedule:
interval: "weekly"
commit-message:
prefix: "chore(deps):"
- package-ecosystem: "npm"
directory: "/tasks/quickstart"
schedule:
interval: "weekly"
commit-message:
prefix: "chore(deps):"
# For pnpm with a catalog, we want to update the versions in the manifest files.
versioning-strategy: increase
groups:
# Group all dependencies into a single PR.
all-deps:
patterns:
- "*"
37 changes: 19 additions & 18 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,24 @@ jobs:
- uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5
with:
cache: 'pnpm'
cache: "pnpm"
- run: pnpm i
- run: pnpm check
- name: Write test credentials
run: |
mkdir "${HOME}/secrets"
echo "${DEFAULT_CREDENTIALS}" > "${HOME}/secrets/default_credentials.json"
echo "${SERVICE_ACCOUNT_CREDENTIALS}" > "${HOME}/secrets/service_account.json"
echo "${CLIENT_ID_FILE}" > "${HOME}/secrets/client_id.json"
env:
DEFAULT_CREDENTIALS: ${{secrets.SNIPPETS_DEFAULT_CREDENTIALS}}
SERVICE_ACCOUNT_CREDENTIALS: ${{secrets.SNIPPETS_DELEGATED_ADMIN_SERVICE_ACCOUNT}}
CLIENT_ID_FILE: ${{secrets.SNIPPETS_CLIENT_ID_FILE}}
- name: Run tests
run: |
export GOOGLE_APPLICATION_CREDENTIALS="${HOME}/secrets/default_credentials.json"
export SERVICE_ACCOUNT_CREDENTIALS="${HOME}/secrets/service_account.json"
pnpm test
env:
GOOGLE_CLOUD_PROJECT: workspace-samples-ci
# Tests are failing due to scope/grant errors.
# - name: Write test credentials
# run: |
# mkdir "${HOME}/secrets"
# echo "${DEFAULT_CREDENTIALS}" > "${HOME}/secrets/default_credentials.json"
# echo "${SERVICE_ACCOUNT_CREDENTIALS}" > "${HOME}/secrets/service_account.json"
# echo "${CLIENT_ID_FILE}" > "${HOME}/secrets/client_id.json"
# env:
# DEFAULT_CREDENTIALS: ${{secrets.SNIPPETS_DEFAULT_CREDENTIALS}}
# SERVICE_ACCOUNT_CREDENTIALS: ${{secrets.SNIPPETS_DELEGATED_ADMIN_SERVICE_ACCOUNT}}
# CLIENT_ID_FILE: ${{secrets.SNIPPETS_CLIENT_ID_FILE}}
# - name: Run tests
# run: |
# export GOOGLE_APPLICATION_CREDENTIALS="${HOME}/secrets/default_credentials.json"
# export SERVICE_ACCOUNT_CREDENTIALS="${HOME}/secrets/service_account.json"
# pnpm test
# env:
# GOOGLE_CLOUD_PROJECT: workspace-samples-ci
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,23 @@ This repository contains Node.js samples for Google Workspace APIs.

1. Install [Node.js](https://nodejs.org).
1. Install `pnpm` by running `npm install -g pnpm` or see additional options at https://pnpm.io/installation.
`pnpm` is used with `turborepo` to better handled the many packages in the repository.
`pnpm` is used with `turborepo` to better handled the many packages in the repository.
1. Create a Service Account

Before running tests, create a service account and download `application_credentials.json` in this directory.
Before running tests, create a service account and download `application_credentials.json` in this directory.

To create a service account, follow these steps:
To create a service account, follow these steps:

1. Navigate to the [Google Cloud Console API Dashboard](https://console.cloud.google.com/apis/dashboard)
1. Enable APIs for products you'd like to test snippets for like Slides or Drive.
1. Create a service account key under [Credentials](https://console.cloud.google.com/apis/credentials).
1. After creating a new JSON Service account key without a role and set the env variable `SERVICE_ACCOUNT_CREDENTIALS=some/path/to/application_credentials.json`.
1. Navigate to the [Google Cloud Console API Dashboard](https://console.cloud.google.com/apis/dashboard)
1. Enable APIs for products you'd like to test snippets for like Slides or Drive.
1. Create a service account key under [Credentials](https://console.cloud.google.com/apis/credentials).
1. After creating a new JSON Service account key without a role and set the env variable `SERVICE_ACCOUNT_CREDENTIALS=some/path/to/application_credentials.json`.

1. `pnpm test`
1. `pnpm lint`
1. Delete service account file.
1. `pnpx codemod pnpm/catalog` to add package dependencies to the catalog
1. `pnpx codemod pnpm/catalog` to add package dependencies to the catalog.
1. `pnpm -r -L update` to update all package depencies to the latest version.

## Contributing

Expand Down
2 changes: 1 addition & 1 deletion drive/snippets/drive_v2/drive_snippets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"check": "tsc --noEmit"
},
"devDependencies": {
"@types/uuid": "^10.0.0",
"@types/uuid": "catalog:",
"google-auth-library": "catalog:",
"typescript": "catalog:"
},
Expand Down
2 changes: 1 addition & 1 deletion drive/snippets/drive_v3/drive_snippets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"check": "tsc --noEmit"
},
"devDependencies": {
"@types/uuid": "^10.0.0",
"@types/uuid": "catalog:",
"google-auth-library": "catalog:",
"typescript": "catalog:"
},
Expand Down
4 changes: 2 additions & 2 deletions forms/snippets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
},
"dependencies": {
"@google-cloud/local-auth": "catalog:",
"@googleapis/drive": "^15.0.0",
"@googleapis/forms": "^4.0.1",
"@googleapis/drive": "catalog:",
"@googleapis/forms": "catalog:",
"googleapis": "catalog:"
},
"devDependencies": {
Expand Down
Loading
Loading