-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #72 from Andrew-Chen-Wang/revert-68-in-source-to-i…
…n-wiki-links Revert "Add in-source to in-wiki link transformer"
- Loading branch information
Showing
10 changed files
with
105 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
cliw eol=lf | ||
cli.ts eol=lf | ||
*.sh eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,11 +111,6 @@ is specific to GitHub wikis. | |
not push to the remote wiki. The default is `false`. This is useful for | ||
testing. | ||
|
||
- **`preprocess`:** If this option is true, we will preprocess the wiki to move | ||
the `README.md` to `Home.md` as well as rewriting all `.md` links to be bare | ||
links. This helps ensure that the Markdown works in source control as well as | ||
the wiki. The default is true. | ||
|
||
#### `strategy:` input | ||
|
||
There are some specific usecases where using `strategy: init` might be better | ||
|
@@ -138,6 +133,28 @@ than the default `strategy: clone`. | |
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 | ||
them viewable in GitHub source view (with the `.md`) _as well as_ in GitHub wiki | ||
(without the `.md`; pretty URLs!). You can use a preprocessing action like | ||
[Strip MarkDown extensions from links action] to remove those `.md` suffixes | ||
before using this action. Here's an example: | ||
|
||
```yml | ||
publish-wiki: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: impresscms-dev/[email protected] | ||
with: | ||
path: wiki | ||
- uses: Andrew-Chen-Wang/github-wiki-action@v4 | ||
``` | ||
|
||
❤️ If you have an awesome preprocessor action that you want to add here, let us | ||
know! We'd love to add an example. | ||
|
||
### Cross-repo wikis | ||
|
||
You _can_ use this action to deploy your octocat/mega-docs repository to the | ||
|
@@ -172,24 +189,9 @@ jobs: | |
path: . | ||
``` | ||
|
||
## Development | ||
|
||
![Deno](https://img.shields.io/static/v1?style=for-the-badge&message=Deno&color=000000&logo=Deno&logoColor=FFFFFF&label=) | ||
![GitHub Actions](https://img.shields.io/static/v1?style=for-the-badge&message=GitHub+Actions&color=2088FF&logo=GitHub+Actions&logoColor=FFFFFF&label=) | ||
|
||
This GitHub Action uses a self-downloaded version of Deno. See `cliw` for the | ||
`cli.ts` wrapper script that downloads the Deno binary and runs the TypeScript | ||
code. The main script itself is ~100 lines of code, so it's not too bad. | ||
|
||
ℹ Because the version of Deno is _pinned_, it's recommended to every-so-often | ||
bump it to the latest version. | ||
|
||
To test the action, open a PR! The `test-action.yml` workflow will run the code | ||
with `dry-run: true` as well as a real run! Yes, this does get tedious swapping | ||
between your IDE and the PR, but it's the easiest way to test the action. | ||
|
||
<!-- prettier-ignore-start --> | ||
[Decathlon/wiki-page-creator-action#11]: https://github.com/Decathlon/wiki-page-creator-action/issues/11 | ||
[supported markup languages]: https://github.com/github/markup#markups | ||
[Strip MarkDown extensions from links action]: https://github.com/marketplace/actions/strip-markdown-extensions-from-links-action | ||
[PAT]: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token | ||
<!-- prettier-ignore-end --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
# Copyright 2023 Jacob Hummer | ||
# SPDX-License-Identifier: Apache-2.0 | ||
set -e | ||
if [[ -n $RUNNER_DEBUG ]]; then | ||
set -x | ||
fi | ||
|
||
export GITHUB_TOKEN="$INPUT_TOKEN" | ||
export GITHUB_SERVER_URL="$INPUT_GITHUB_SERVER_URL" | ||
export GITHUB_REPOSITORY="$INPUT_REPOSITORY" | ||
export GH_HOST="${GITHUB_SERVER_URL#*//}" | ||
|
||
export GIT_DIR && GIT_DIR=$(mktemp -d) | ||
export GIT_WORK_TREE="$INPUT_PATH" | ||
trap 'rm -rf "$GIT_DIR"' SIGINT SIGTERM ERR EXIT | ||
|
||
gh auth setup-git | ||
git config --global --add safe.directory "$GIT_DIR" | ||
|
||
git clone "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY.wiki.git" "$GIT_DIR" --bare | ||
git config --unset core.bare | ||
|
||
echo "$INPUT_IGNORE" >>"$GIT_DIR/info/exclude" | ||
git add -Av | ||
|
||
# https://github.com/stefanzweifel/git-auto-commit-action/blob/master/action.yml#L35-L42 | ||
git config user.name github-actions[bot] | ||
git config user.email 41898282+github-actions[bot]@users.noreply.github.com | ||
git commit --allow-empty -m "$INPUT_COMMIT_MESSAGE" | ||
|
||
if [[ $INPUT_DRY_RUN == true ]]; then | ||
echo 'Dry run' | ||
git remote show origin | ||
git show | ||
exit 0 | ||
fi | ||
|
||
git push origin master | ||
echo "wiki_url=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/wiki" >>"$GITHUB_OUTPUT" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
# Copyright 2023 Jacob Hummer | ||
# SPDX-License-Identifier: Apache-2.0 | ||
set -e | ||
if [[ -n $RUNNER_DEBUG ]]; then | ||
set -x | ||
fi | ||
|
||
export GITHUB_TOKEN="$INPUT_TOKEN" | ||
export GITHUB_SERVER_URL="$INPUT_GITHUB_SERVER_URL" | ||
export GITHUB_REPOSITORY="$INPUT_REPOSITORY" | ||
export GH_HOST="${GITHUB_SERVER_URL#*//}" | ||
|
||
export GIT_DIR && GIT_DIR=$(mktemp -d) | ||
export GIT_WORK_TREE="$INPUT_PATH" | ||
trap 'rm -rf "$GIT_DIR"' SIGINT SIGTERM ERR EXIT | ||
|
||
gh auth setup-git | ||
git config --global --add safe.directory "$GIT_DIR" | ||
|
||
git init -b master | ||
git remote add origin "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY.wiki.git" | ||
|
||
echo "$INPUT_IGNORE" >>"$GIT_DIR/info/exclude" | ||
git add -Av | ||
|
||
git config user.name github-actions[bot] | ||
git config user.email 41898282+github-actions[bot]@users.noreply.github.com | ||
|
||
git commit --allow-empty -m "$INPUT_COMMIT_MESSAGE" | ||
|
||
if [[ $INPUT_DRY_RUN == true ]]; then | ||
echo 'Dry run' | ||
git remote show origin | ||
git show | ||
exit 0 | ||
fi | ||
|
||
git push -f origin master | ||
echo "wiki_url=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/wiki" >>"$GITHUB_OUTPUT" |