From e05f05cc0eebaaeca33306e771c978331a6857eb Mon Sep 17 00:00:00 2001 From: atom-tr Date: Fri, 13 Oct 2023 17:17:47 +0700 Subject: [PATCH] . --- README.md | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- action.yml | 2 +- 2 files changed, 81 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index cb30e72..130431b 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,80 @@ -# apps-script-sync -Sync files to script.google.com project +# Google Apps Script Sync + +

+ + +

+ +---- + +

+ + + + + Star Badge +

+

+ Are you tired of copy-pasting your code to script.google.com?
+ This tool will help you to sync your files to script.google.com project. +

+ +

+ Report Bug + ยท + Request Feature +

+ +## Prerequisites + +1. Create a new Google Apps Script project at . + - Get the project ID from the URL. It is the string between `/d/` and `/edit`. +2. Follow the instructions at to: + - Enable the Google Apps Script API for your project + - Download the `credentials.json` file to your computer + - Get the `token.json` file. +3. You will need a GitHub token with `repo` scope. You can create one at + > enabling the repo scope seems **DANGEROUS** + but this is the only way to access the repository files and sync them to Google Script. +4. Save secrets in your repository settings. + - `GH_TOKEN`: GitHub token + - `PROJECT_ID`: Google Script project ID + - `CLIENT_ID`: Google app client ID + - `CLIENT_SECRET`: Google app client secret + - `REFRESH_TOKEN`: Google app refresh token + +## Workflow + +First, you need to create a new repository for your project. Then, you need to create a new workflow file in `.github/workflows` folder. You can use the following template: + +```yaml +name: Sync to script.google + +on: [push] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + matrix: + python: ["3.11"] + + steps: + - uses: actions/checkout@v4 + - name: Setup Python + uses: atom-tr/apps-script-sync@main + with: + # Github + GH_TOKEN: ${{ secrets.GH_TOKEN }} + # Google Script + PROJECT_ID: ${{ secrets.PROJECT_ID }} # Project ID, you can get it from the URL of your project + PROJECT_PATH: # Project path, where the folder in repo will be synced to in Google Script, default is src + # Google app + # CLIENT_TYPE: installed + CLIENT_ID: ${{ secrets.CLIENT_ID }} + CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} + REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }} +``` + +When you push your code to the repository, the workflow will be triggered and it will sync your code to Google Script. diff --git a/action.yml b/action.yml index 6b7f158..fd0f263 100644 --- a/action.yml +++ b/action.yml @@ -12,7 +12,7 @@ inputs: PROJECT_PATH: description: "ProjectPath" - required: true + default: "src" TIMEZONE: description: "TimeZone"