Skip to content

Commit

Permalink
Merge pull request #63 from Andrew-Chen-Wang/56-add-wiki_url-output
Browse files Browse the repository at this point in the history
Add wiki_url output
  • Loading branch information
jcbhmr authored Jun 9, 2023
2 parents 46a496d + 699f1da commit 5daa8c4
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ replacing every `-` (dash) character with a space. Name your files accordingly.
The `Home.md` file will automatically become the homepage, not `README.md`. This
is specific to GitHub wikis.

### Options
### Inputs

- **`strategy`:** Select from `clone` or `init` to determine which method to use
to push changes to the GitHub wiki. `clone` will clone the `.wiki.git` repo
Expand Down Expand Up @@ -116,7 +116,7 @@ is specific to GitHub wikis.
not push to the remote wiki. The default is `false`. This is useful for
testing.

#### `strategy:` option
#### `strategy:` input

There are some specific usecases where using `strategy: init` might be better
than the default `strategy: clone`.
Expand All @@ -132,6 +132,12 @@ than the default `strategy: clone`.
push using `strategy: init` on each wiki deployment and none of that pesky
history will be saved.

### Outputs

- **`wiki_url`:** The HTTP URL that points to the deployed repository's wiki
tab. This is essentially the concatenation of `${{ github.server_url }}`,
`${{ github.repository }}`, and the `/wiki` page.

### Preprocessing

You may wish to strip the `[link](page.md)` `.md` suffix from your links to make
Expand Down
10 changes: 9 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,18 @@ inputs:
push to the remote wiki. The default is false. This is useful for testing.
required: true
default: false
outputs:
wiki_url:
description: >-
The HTTP URL that points to the deployed repository's wiki tab. This is
essentially the concatenation of github.server_url, github.repository, and
the /wiki page.
value: ${{ steps.main.outputs.wiki_url }}
runs:
using: composite
steps:
- run: '"${GITHUB_ACTION_PATH%/}/src/$INPUT_STRATEGY.sh"'
- id: main
run: '"${GITHUB_ACTION_PATH%/}/src/$INPUT_STRATEGY.sh"'
shell: bash
env:
INPUT_STRATEGY: ${{ inputs.strategy }}
Expand Down
1 change: 1 addition & 0 deletions src/clone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ if [[ $INPUT_DRY_RUN == true ]]; then
fi

git push origin master
echo "wiki_url=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/wiki" >>"$GITHUB_OUTPUT"
1 change: 1 addition & 0 deletions src/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ if [[ $INPUT_DRY_RUN == true ]]; then
fi

git push -f origin master
echo "wiki_url=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/wiki" >>"$GITHUB_OUTPUT"

0 comments on commit 5daa8c4

Please sign in to comment.