Coder Social home page Coder Social logo

claat-action's Introduction

CLaaT (Codelabs as a Thing) export

This composite action exports Google documents using CLaaT as a codelab in HTML, Markdown, or offline format. It can also convert a Markdown file (.md) to a codelab in HTML.

Tip

Use the Go module installer to get the latest version of CLaaT with support for Google Analytics v4.

To install claat on your machine:

go install github.com/googlecodelabs/tools/claat@latest`

To check available commands and flags of claat:

claat help

V1

This action has become simply a wrapper for the claat command. You need to set it up before using it. You can refer to the setup instructions in the setup action

Inputs

Input Description Required
command CLaaT command
Default (action): export
No
source Accepted formats: Google doc ID or Markdown file (.md). Ignored if codelabs-json is set.
Default (action): ''
Yes
auth Google OAuth2.0 token (required for Google docs, except for .md to HTML conversion).
Default (action): ''
No
codelabs-path Path to save exported codelab(s).
Default (action): ''
Default (claat): .
No
gaid Google Analytics ID
Default (action):''
Default (claat):UA-49880327-14
No
ga4id Google Analytics v4 ID
Default (action): ''
Default (claat):not implimented
No
codelabs-json Path to a JSON file containing a list of Google document IDs.
Default (action): ''
No
format Export format (html, md, offline or all).
Default (action): html
Default (claat): html
No
environment codelab environment
Default (action): ''
Default (claat):web
No
prefix URL prefix for html format
Default (action): ''
Default (claat):https://storage.googleapis.com
No
elements-path Local path (JS and CSS) of codelab elements. (in case Google prefix is broken)
Default (action): elements/codelab-elements
No
elements-default-path External path (JS and CSS) of codelab elements. (hosted by Google)
Default (action): claat-public
No
extra Additional arguments to pass to format templates. JSON object of string,string key values.
Default (action): ''
No
metadata Metadata fields to pass through to the output. Comma-delimited list of field names.
Default (action): ''
No

Example Usage

This example showcases exporting a single Google document with ID "1234567890abcdef" to HTML format:

name: Export codelab from Google Doc

on:
  push:

jobs:
  export:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - name: Generate Oauth2 token
        id: "auth"
        uses: "google-github-actions/auth@v2"
        with:
          token_format: "access_token"
          access_token_scopes: "https://www.googleapis.com/auth/drive.readonly"
          credentials_json: "${{ secrets.SERVICE_ACCOUNT_CREDS }}"
    - name: Export codelab
      uses: "khammami/claat-action@[version|main]"
      with:
        auth: ${{ steps.auth.outputs.access_token }}
        source: '1234567890abcdef'
        format: 'html'

This example exports multiple Google documents listed in a JSON file named codelabs.json to both HTML and Markdown formats, including an optional id property for each codelab:

name: Export multiple codelabs from JSON

on:
  push:

jobs:
  export:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - name: Generate Oauth2 token
        id: "auth"
        uses: "google-github-actions/auth@v2"
        with:
          token_format: "access_token"
          access_token_scopes: "https://www.googleapis.com/auth/drive.readonly"
          credentials_json: "${{ secrets.SERVICE_ACCOUNT_CREDS }}"
    - name: Export codelabs
      uses: "khammami/claat-action@[version|main]"
      with:
        auth: ${{ steps.auth.outputs.access_token }}
        codelabs-json: 'codelabs.json'
        format: 'all'

codelabs.json:

[
  {
    "id": "codelab-1",
    "source": "Google document ID"
  },
  {
    "id": "codelab-2",
    "source": "path/codelab.md"
  }
]

License

The scripts and documentation in this project are released under the Apache 2.0 License

Code of Conduct

๐Ÿ‘‹ Be nice. See our code of conduct

Note

This composite has been moved from codelabs-enetcom-md

claat-action's People

Contributors

khammami avatar

Watchers

 avatar

claat-action's Issues

Reset inputs default values

For general use, this action default values should match claat defaults (or empty by default & let claat handle the defaults)

Directory name generation with 'all' format broken

The expected behavior is:

  • If the export directory is empty and the format is 'all', the folder name will be 'md' for the format 'md'. โœ…
  • If a directory name is provided, '-md' will be appended to the format. โŒ

Offline format is missing in 'all'

This is not a bug, as the functionality to export both HTML and Markdown formats at once was intentionally introduced in this action through the addition of 'all' in the previous repository.

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.