Giter Site home page Giter Site logo

daikikatsuragawa / clasp-action Goto Github PK

View Code? Open in Web Editor NEW
28.0 3.0 13.0 20 KB

This action uses clasp to push or deploy to Google Apps Script.

Home Page: https://github.com/marketplace/actions/clasp-action

License: MIT License

Shell 91.55% Dockerfile 8.45%
clasp google-apps-script apps-script actions github-action github-actions-docker gas ci docker shell

clasp-action's Introduction

Clasp Action

This action uses clasp to push or deploy to Google Apps Script. This action is running clasp push -f regardless of whether you select push or deploy as the command. This will force the remote manifest to be overwritten.

Inputs

accessToken

Required access_token written in .clasprc.json.

idToken

Required id_token written in .clasprc.json.

refreshToken

Required refresh_token written in .clasprc.json.

clientId

Required clientId written in .clasprc.json.

clientSecret

Required clientSecret written in .clasprc.json.

scriptId

Required scriptId written in .clasp.json.

rootDir

Directory where scripts are stored.

command

Required Command to execute(push or deploy).

If deploy is selected, this action is running clasp push -f just before.

Deploy works for max. 20 deployments due to Gas limit on active deployments and complexity to determine which deployment should be deleted. Workaround : Set deployId.

description

Description of the deployment.

deployId

Deploy ID that will be updated with this push.

Example usage

Case to push

- uses: daikikatsuragawa/[email protected]
  with:
    accessToken: ${{ secrets.ACCESS_TOKEN }}
    idToken: ${{ secrets.ID_TOKEN }}
    refreshToken: ${{ secrets.REFRESH_TOKEN }}
    clientId: ${{ secrets.CLIENT_ID }}
    clientSecret: ${{ secrets.CLIENT_SECRET }}
    scriptId: ${{ secrets.SCRIPT_ID }}
    command: 'push'

Case to deploy

- uses: daikikatsuragawa/[email protected]
  with:
    accessToken: ${{ secrets.ACCESS_TOKEN }}
    idToken: ${{ secrets.ID_TOKEN }}
    refreshToken: ${{ secrets.REFRESH_TOKEN }}
    clientId: ${{ secrets.CLIENT_ID }}
    clientSecret: ${{ secrets.CLIENT_SECRET }}
    scriptId: ${{ secrets.SCRIPT_ID }}
    command: 'deploy'

Case to deploy with description

- uses: daikikatsuragawa/[email protected]
  with:
    accessToken: ${{ secrets.ACCESS_TOKEN }}
    idToken: ${{ secrets.ID_TOKEN }}
    refreshToken: ${{ secrets.REFRESH_TOKEN }}
    clientId: ${{ secrets.CLIENT_ID }}
    clientSecret: ${{ secrets.CLIENT_SECRET }}
    scriptId: ${{ secrets.SCRIPT_ID }}
    command: 'deploy'
    description: 'Sample description'

Case to specify the directory where scripts are stored

- uses: daikikatsuragawa/[email protected]
  with:
    accessToken: ${{ secrets.ACCESS_TOKEN }}
    idToken: ${{ secrets.ID_TOKEN }}
    refreshToken: ${{ secrets.REFRESH_TOKEN }}
    clientId: ${{ secrets.CLIENT_ID }}     
    clientSecret: ${{ secrets.CLIENT_SECRET }}
    scriptId: ${{ secrets.SCRIPT_ID }}
    rootDir: 'src'
    command: 'push'

Case to update a specific deploy

- uses: daikikatsuragawa/[email protected]
  with:
    accessToken: ${{ secrets.ACCESS_TOKEN }}
    idToken: ${{ secrets.ID_TOKEN }}
    refreshToken: ${{ secrets.REFRESH_TOKEN }}
    clientId: ${{ secrets.CLIENT_ID }}
    clientSecret: ${{ secrets.CLIENT_SECRET }}
    scriptId: ${{ secrets.SCRIPT_ID }}
    command: 'deploy'
    deployId: ${{ secrets.DEPLOY_ID }}

License summary

This code is made available under the MIT license.

clasp-action's People

Contributors

alex-galey avatar daikikatsuragawa avatar jarradprice avatar joseffffff avatar rmuraix avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

clasp-action's Issues

Push Error

Trying to use the action, but getting this error, does any1 knows how to solve it?

Run daikikatsuragawa/[email protected]
/usr/bin/docker run --name e1cc5172726b56add94e218e34c05e664cb352_caa02e --label e1cc51 --workdir /github/workspace --rm -e INPUT_ACCESSTOKEN -e INPUT_IDTOKEN -e INPUT_REFRESHTOKEN -e INPUT_CLIENTID -e INPUT_CLIENTSECRET -e INPUT_SCRIPTID -e INPUT_COMMAND -e INPUT_ROOTDIR -e INPUT_DESCRIPTION -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e 
GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_RUN_ATTEMPT -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -
e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_NAME -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e 
ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v 
"/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v 
"/home/runner/work/_temp/_github_workflow":"/github/workflow" -v 
"/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v 
"/home/runner/work/slick/slick":"/github/workspace" e1cc51:72726b56add94e218e34c05e664cb352  "***" "***" "***" 
"***" "***" "***" "" "push" ""
ENOENT: no such file or directory, open '/github/workspace/appsscript.json'

here's the action i have:

name: Apps Script CI

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]
jobs:
  deploy-apps-Script:
    runs-on: ubuntu-latest
    steps:
      - uses: daikikatsuragawa/[email protected]
        with:
          accessToken: ${{ secrets.ACCESS_TOKEN }}
          idToken: ${{ secrets.ID_TOKEN }}
          refreshToken: ${{ secrets.REFRESH_TOKEN }}
          clientId: ${{ secrets.CLIENT_ID }}
          clientSecret: ${{ secrets.CLIENT_SECRET }}
          scriptId: ${{ secrets.SCRIPT_ID }}
          command: 'push'

All files (appscript.json, code.js and .clasp.json) lives in the root folder, and the action is in .github/workflows

SyntaxError for Google Clasp v2.4.0

Hey guys, thank you for this repo, it's been insanely useful.

When the action runs with the latest version of Clasp on GH Actions, it returns an error that seems to originate from a bug in Clasp v2.4.0.

/usr/lib/node_modules/@google/clasp/build/src/index.js:2
import why from 'wtfnode'; // should be your first require
       ^^^

SyntaxError: Unexpected identifier
    at Module._compile (internal/modules/cjs/loader.js:723:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)

Possible Solution:

This would be temporary, but using Clasp v2.3.2 should fix it until a patch is rolled out in the Clasp repo. I can file a PR if you would like!

Deploy automatically 20 times only

Deploy auto doesn't work anymore after 20 deployments have been done :
Run daikikatsuragawa/clasp-action@v1 with command deploy return :

Created version 21.
Scripts may only have up to 20 versioned deployments at a time.

Fix idea : run clasp undeploy when this limit has been reached
How to find 20 deployments are active ?
How to undeploy only the oldest one ?

Workaround : Archive manually all unecessary deployments

Deployment errors should show a failed deployment in Github Actions

I had difficulties spotting a bug in a script today because Github action deployments were green for success but deployments had failed indeed. So I thought the bug was in the script logic ...

Deployment error due to Gaxios errors should throw an error

  • Pushing files…
    Push failed. Errors:
    GaxiosError: Syntax error: SyntaxError:

@daikikatsuragawa, @joseffffff, do you have an idea how I could implement this behaviour ?

ENOENT: no such file or directory, open '/appsscript.json'

Run daikikatsuragawa/[email protected]
  with:
    accessToken: ***
    idToken: ***
    refreshToken: ***
    clientId: ***
    clientSecret: ***
    scriptId: ***
    rootDir: ***
    command: push
##[debug]Evaluating: inputs.accessToken
##[debug]Evaluating Index:
##[debug]..Evaluating inputs:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'accessToken'
##[debug]=> '***'

I am passing GitHub Secrets as arguments for all the required fields of this Action.

The Action runs on changes to the main branch.

The main branch structure has the Action main.yml file under /.github/workflows.

When the main.yml file is executed the following error occurs at runtime:

ENOENT: no such file or directory, open '/appsscript.json'

The /appscript.json file is located at the root directory.

I attempted to replace the GitHub Secret for the object rootDir to a string literal, but with no resolve.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.