From bff26e669a58e5d859f1b510b2d787fe318f8d73 Mon Sep 17 00:00:00 2001 From: James Dow Date: Fri, 30 Apr 2021 18:25:05 -0500 Subject: [PATCH] adding github action usage --- README.md | 75 +++++++++++++++++++++++++++++++++++++++++++++++++--- action.js | 4 --- package.json | 4 +-- 3 files changed, 73 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index e252039..c13be31 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,8 @@ This action offers a number of helpers to help automate some of the laborious ta ## Getting started -##### Add templating placeholders to `.md` -Each of the helpers has a beginning and an end. It's identified via it's unique `ID`. Anything you put in-between the start and end will be replaced by auto generated content. +### Template +To start off with you need to add as many or as few templating placeholders to your markdown files. Each of the helpers has a beginning and an end. It's identified via it's unique `ID`. Anything you put in-between the start and end will be replaced by auto generated content. ```markdown @@ -77,13 +77,80 @@ Each of the helpers has a beginning and an end. It's identified via it's unique -##### Run script +### GitHub Actions +You can find this script in the [GitHub Action Marketplace](https://github.com/marketplace/actions/wiki-helpers). Below are a two ways you can use this within your action workflow. + +#### Usage + +```yml +- name: Wiki Helpers + uses: photodow/wiki-helpers@v1.5 +``` + +
+Edit wiki files directly + +```yml +name: Edit wiki files +on: + gollum: + workflow_dispatch: + +jobs: + update: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + repository: ${{github.repository}}.wiki + - uses: photodow/wiki-helpers@v1.5 + with: + rootPath: ./ + buildPath: ./ + - name: Commit changes + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: Github Actions - Wiki helpers +``` + +
+ +
+Edit in repo, and copy to wiki + +```yml +name: Repo to wiki +on: + workflow_dispatch: + push: + branches: + - main + +jobs: + update: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: photodow/wiki-helpers@v1.5 + with: + rootPath: "./samples" + - name: Upload Documentation to Wiki + uses: SwiftDocOrg/github-wiki-publish-action@v1 + with: + path: "./build" + env: + GH_PERSONAL_ACCESS_TOKEN: ${{ secrets.WIKI_HELPER }} +``` + +
+ +### Run script ```terminal npm run build [...optionName=optionValue] ``` -###### Script options +### Options | name | type | description | |:----------------|:----------|:------------| diff --git a/action.js b/action.js index fd0fa9d..133b0ea 100644 --- a/action.js +++ b/action.js @@ -10,10 +10,6 @@ try { depsTitleHook: core.getInput('depsTitleHook'), buildPath: core.getInput('buildPath') }); - - // Get the JSON webhook payload for the event that triggered the workflow - const payload = JSON.stringify(github.context.payload, undefined, 2) - console.log(`The event payload: ${payload}`); } catch (error) { core.setFailed(error.message); } \ No newline at end of file diff --git a/package.json b/package.json index 405e97e..d0f0f6d 100644 --- a/package.json +++ b/package.json @@ -5,8 +5,8 @@ "main": "./lib/index.js", "scripts": { "build": "node ./index.js rootPath=./samples", - "overwrite": "node ./index.js buildPath=./", - "reset": "node ./index.js resetOnly=true buildPath=./", + "overwrite": "node ./index.js rootPath=./samples buildPath=./samples", + "reset": "node ./index.js resetOnly=true rootPath=./samples buildPath=./samples", "new-files": "node ./copy-new-files.js", "prepare": "husky install" },