Skip to content

Commit

Permalink
adding github action usage
Browse files Browse the repository at this point in the history
  • Loading branch information
photodow committed Apr 30, 2021
1 parent 811b8da commit bff26e6
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 10 deletions.
75 changes: 71 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
<!-- {{ID}} start [...optionName=optionValue] -->
Expand Down Expand Up @@ -77,13 +77,80 @@ Each of the helpers has a beginning and an end. It's identified via it's unique
</details>

##### 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/[email protected]
```
<details>
<summary><strong>Edit wiki files directly</strong></summary>
```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/[email protected]
with:
rootPath: ./
buildPath: ./
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Github Actions - Wiki helpers
```
</details>
<details>
<summary><strong>Edit in repo, and copy to wiki</strong></summary>
```yml
name: Repo to wiki
on:
workflow_dispatch:
push:
branches:
- main

jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: photodow/[email protected]
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 }}
```
</details>
### Run script
```terminal
npm run build [...optionName=optionValue]
```

###### Script options
### Options

| name | type | description |
|:----------------|:----------|:------------|
Expand Down
4 changes: 0 additions & 4 deletions action.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down

0 comments on commit bff26e6

Please sign in to comment.