Giter Site home page Giter Site logo

actions's Introduction

Carnap actions status

Carnap Upload GitHub Action

This GitHub Action uses the new Carnap API to upload documents such as textbooks.

Usage

Go to Carnap and obtain your API key from the instructor page on the "Manage Uploaded Documents" tab of the instructor homepage.

Add this API key as a secret to your GitHub repository settings under the name CARNAP_API_KEY.

Create a file called .github/workflows/ci.yaml (or some other name) with the contents:

name: 'Deploy markdown files to Carnap'
on:
  push:
    branches:
      - main

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Deploy
        uses: carnap/actions@v1
        with:
          apiKey: '${{ secrets.CARNAP_API_KEY }}'
          # make any newly created documents private
          defaultVisibility: 'Private'
          # files to include in the upload (important: this must be quoted)
          includeFiles: '["*.md"]'
          instanceUrl: 'https://carnap.io'

Then, you can push some markdown to the repo to test everything works and shows up on your Carnap account.

Configuration reference

apiKey

Required: true

API key to use to authenticate to Carnap. Do not put the API key in your workflow file.

You should set this to something like ${{ secrets.CARNAP_API_KEY }}.

defaultVisibility

Required: false

Default: Private

Visibility setting for newly created files. Can be Public, InstructorsOnly, LinkOnly or Private.

The permissions on existing files will not be changed.

includeFiles

Required: false

Default: '["*.md"]'

Files that will be uploaded to Carnap. This is in the form of a JSON list inside a string, containing Unix-style globs matching file names to upload. These are evaluated relative to the root folder of the project without recursing into subdirectories.

The default is to take every .md file in the root directory of the project.

instanceUrl

Required: false

Default: "https://carnap.io"

URL of the Carnap instance to deploy to

Command line interface

This repository also provides the carnap command line interface that does the same thing as the GitHub Action. If you want to use it, it's available via npm. You should need at least node 12.

First, add the GitHub npm registry for the @carnap namespace:

$ echo '@carnap:registry=https://npm.pkg.github.com' >> $HOME/.npmrc

Then you can use the Carnap CLI as follows (no install ๐Ÿ™‚):

$ npx @carnap/actions upload --help
CARNAP_API_KEY=... carnap upload -b <basepath> -i '<includeFilesJsonList>' [options]

Options:
      --help               Show help                                   [boolean]
      --version            Show version number                         [boolean]
  -b, --basePath           base path to the files to upload  [string] [required]
  -i, --includeFiles       JSON list of globs matching files to include
                                                             [string] [required]
      --url                URL to the Carnap instance to upload to
                                         [string] [default: "https://carnap.io"]
      --defaultVisibility  Default visibility of newly created documents.
         [choices: "Public", "InstructorsOnly", "LinkOnly", "Private"] [default:
                                                                      "Private"]

Troubleshooting

The Carnap action has debug logging that may provide useful information to diagnose issues. Enable it by setting a secret on the repository called ACTIONS_STEP_DEBUG with a value of true.

actions's People

Contributors

dependabot[bot] avatar lf- avatar hross avatar bryanmacfarlane avatar thboop avatar yamboy1 avatar omarabid avatar estrada9166 avatar covertbert avatar logerfo avatar hashtagchris avatar singingwolfboy avatar heroiceric avatar gowee avatar jasonetco avatar joshmgross avatar jj avatar vtbassmatt avatar mscoutermarsh avatar foolip avatar rferro avatar shawnnapora avatar svenstaro avatar potato4d avatar iamhughes avatar tingluohuang avatar jackton1 avatar wilhelmklopp avatar azu avatar starfish719 avatar

Stargazers

 avatar David Sanson avatar Graham Leach-Krouse avatar

Watchers

James Cloos avatar Graham Leach-Krouse avatar  avatar  avatar

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.