forked from actions/tailwind-crawler
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Initial commit
- Loading branch information
Greg Brimble
committed
Apr 25, 2020
1 parent
82fa79a
commit 9988d88
Showing
8 changed files
with
26,750 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# This file is given to the crawler, and can be used to configure various settings | ||
# At the time of writing, killman/tailwindui-crawler supports the following. | ||
# However, new features should also be supported, assuming you are using an up-to-date version of the crawler. | ||
|
||
HTMLMODE=alpine # alpine | comments | ||
BUILDINDEX=1 # 0 | 1 | ||
|
||
TRANSFORMERS=addTailwindCss,prefixSrc,useInter,changeColor,changeLogo,prefixClasses,convertReact,stripAlpine | ||
|
||
# addTailwindCss | ||
ADDTAILWINDCSS_URL=http://localhost/path/to/css # defaults to twui CDN | ||
|
||
# convertVue | ||
VUE_OUTPUT=$OUTPUT/vue # path to save Vue files (defaults to $OUTPUT) | ||
|
||
# convertReact | ||
CONVERTREACT_OUTPUT=$OUTPUT/react # path to save React files (default to $OUTPUT) | ||
|
||
# stripAlpine | ||
STRIPALPINE_OUTPUT=$OUTPUT/no-alpine # path to save stripped HTML files (REQUIRED) | ||
|
||
# changeColor | ||
CHANGECOLOR_TO=red # name of color to change from indigo | ||
|
||
# changeLogo | ||
CHANGELOGO_URL=http://localhost/path/to/logo # URL of logo (defaults to generic tailwind logo) | ||
|
||
# prefixClasses | ||
PREFIXCLASSES_PREFIX=tw- # adds prefix to all tailwind classes |
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,6 @@ | ||
FROM node:13-alpine | ||
RUN apk update && apk upgrade && \ | ||
apk add --no-cache bash git openssh | ||
COPY entrypoint.sh /entrypoint.sh | ||
COPY lib/actions/checkout/index.js /checkout.js | ||
ENTRYPOINT ["/entrypoint.sh"] |
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 +1,7 @@ | ||
# tailwindui-crawler-github-action | ||
# Tailwind UI Crawler Action | ||
|
||
> Automate the crawling and cataloging of the Tailwind UI components | ||
|
||
## Usage | ||
|
||
Create a **PRIVATE** repository on GitHub, and add this action to run on a schedule. |
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,48 @@ | ||
name: "Crawl Tailwind UI" | ||
author: "Greg Brimble" | ||
description: "Automate the crawling and cataloging of the Tailwind UI components" | ||
inputs: | ||
email: | ||
description: "Your tailwindui.com account email address" | ||
required: true | ||
password: | ||
description: "Your tailwindui.com account password" | ||
required: true | ||
token: | ||
description: "GitHub Token" | ||
required: false | ||
default: ${{ github.token }} | ||
output: | ||
description: "The repository to push the crawler output to (defaults to the current repository)" | ||
required: false | ||
default: ${{ github.repository }} | ||
commitmessage: | ||
description: "The commit message to use when updating the output repository" | ||
required: false | ||
default: "Update tailwindui.com" | ||
branch: | ||
description: "The branch to commit to when updating the output repository" | ||
required: false | ||
default: "master" | ||
force: | ||
description: "Whether or not to force push when updating the output repository" | ||
required: false | ||
default: "false" | ||
actor: | ||
description: "The git actor (defaults to the current user)" | ||
required: false | ||
default: ${{ github.actor }} | ||
repository: | ||
description: "The workspace repository (repository with .env) (defaults to the current repository)" | ||
required: false | ||
default: ${{ github.repository }} | ||
crawler: | ||
description: "The repository of the crawler (defaults to 'kiliman/tailwindui-crawler')" | ||
required: false | ||
default: "kiliman/tailwindui-crawler" | ||
runs: | ||
using: "docker" | ||
image: "Dockerfile" | ||
branding: | ||
icon: "refresh-cw" | ||
color: "blue" |
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,62 @@ | ||
#!/bin/sh | ||
|
||
export WORKSPACE_REPOSITORY="$INPUT_REPOSITORY" | ||
export CRAWLER_REPOSITORY="$INPUT_CRAWLER" | ||
export OUTPUT_REPOSITORY="$INPUT_OUTPUT" | ||
|
||
# Clone crawler | ||
mkdir /crawler | ||
|
||
export GITHUB_WORKSPACE="/crawler" | ||
export GITHUB_REPOSITORY="$CRAWLER_REPOSITORY" | ||
|
||
node /checkout.js | ||
|
||
# Clone workspace | ||
mkdir /workspace | ||
|
||
export GITHUB_WORKSPACE="/workspace" | ||
export GITHUB_REPOSITORY="$WORKSPACE_REPOSITORY" | ||
|
||
node /checkout.js | ||
|
||
# Inject .env from workspace | ||
touch /workspace/.env | ||
cp /workspace/.env /crawler/.env | ||
|
||
# Install crawler dependencies | ||
cd /crawler | ||
npm install | ||
|
||
# Clone output | ||
mkdir /output | ||
|
||
export GITHUB_WORKSPACE="/output" | ||
export GITHUB_REPOSITORY="$OUTPUT_REPOSITORY" | ||
|
||
node /checkout.js | ||
|
||
# Run crawler | ||
|
||
export OUTPUT="/output" | ||
export EMAIL="$INPUT_EMAIL" | ||
export PASSWORD="$INPUT_PASSWORD" | ||
|
||
node /crawler/index.js | ||
|
||
# Commit the changes | ||
cd /output | ||
|
||
git add . | ||
git commit -m "$INPUT_COMMITMESSAGE" | ||
|
||
# Push changes | ||
force_option="" | ||
|
||
if $INPUT_FORCE; then | ||
force_option="--force" | ||
fi | ||
|
||
remote="https://$INPUT_ACTOR:$INPUT_TOKEN@github.com/$OUTPUT_REPOSITORY.git" | ||
|
||
git push $remote "HEAD:$INPUT_BRANCH" $force_option |
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,22 @@ | ||
|
||
The MIT License (MIT) | ||
|
||
Copyright (c) 2018 GitHub, Inc. and contributors | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
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,3 @@ | ||
# Checkout Action | ||
|
||
Taken from [dist/index.js](https://github.com/actions/checkout/blob/01aecccf739ca6ff86c0539fbc67a7a5007bbc81/dist/index.js). |
Oops, something went wrong.