diff --git a/.github/workflows/default.yml b/.github/workflows/default.yml new file mode 100644 index 0000000..c169147 --- /dev/null +++ b/.github/workflows/default.yml @@ -0,0 +1,23 @@ +name: Example/Test +on: + push: + schedule: + - cron: "0 0 * * *" # Every day at midnight + +jobs: + test: + name: Example/Test + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Run crawler + uses: gregbrimble/tailwindui-crawler-action@master + with: + email: ${{ secrets.TAILWINDUI_EMAIL}} + password: ${{ secrets.TAILWINDUI_PASSWORD }} + + # The following are optional (see the README.md for more info) + token: ${{ secrets.TOKEN }} + output: gregbrimble/tailwindui + repository: gregbrimble/tailwindui diff --git a/README.md b/README.md index 729146a..1bda84d 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,50 @@ > Automate the crawling and cataloging of the Tailwind UI components +[![GitHub Actions Example/Test](https://github.com/GregBrimble/tailwindui-crawler-action/workflows/Example/Test/badge.svg)](https://github.com/GregBrimble/tailwindui-crawler-action/actions?query=workflow%3AExample%2FTest) + ## Usage -Create a **PRIVATE** repository on GitHub, and add this action to run on a schedule. +As a part of your [GitHub Actions](https://github.com/features/actions) workflow, add a new step as follows: + +```yml +name: Deploy +on: + push: + schedule: + - cron: "0 0 * * *" # Every day at midnight +jobs: + deploy: + name: Deploy + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Run crawler + uses: gregbrimble/tailwindui-crawler-action@v1.0.0 + with: + email: ${{ secrets.TAILWINDUI_EMAIL }} + password: ${{ secrets.TAILWINDUI_PASSWORD }} +``` + +Read more about the schedule cron syntax in [the official GitHub Actions documentation](https://help.github.com/en/actions/reference/events-that-trigger-workflows#scheduled-events-schedule). + +We strongly advise utilizing [GitHub Actions secrets](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets) to securely store your TailwindUI email and password. + +A full example can be found in [`.github/workflows/default.yml`](https://github.com/GregBrimble/tailwindui-crawler-action/blob/master/.github/workflows/default.yml). + +## Advanced + +The following input options are available: + +| Name | Value | +| ---------- | ----------------------------------------- | +| `email` | Your tailwindui.com account email address | +| `password` | Your tailwindui.com account password | + +Note: If using a separate private repository for the output, you must include a Personal Access Token in the `token` input, as the `{{ github.token }}` tokens are scoped to only the current repository. + +## Roadmap + +[] Specify crawler version +[] Create a PR against the output repository diff --git a/entrypoint.sh b/entrypoint.sh index c56289c..d4396d5 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -3,6 +3,7 @@ export WORKSPACE_REPOSITORY="$INPUT_REPOSITORY" export CRAWLER_REPOSITORY="$INPUT_CRAWLER" export OUTPUT_REPOSITORY="$INPUT_OUTPUT" +export INPUT_REF="master" unset INPUT_REPOSITORY # Clone crawler @@ -49,7 +50,6 @@ export OUTPUT="/output" export EMAIL="$INPUT_EMAIL" export PASSWORD="$INPUT_PASSWORD" -ls /crawler node /crawler/index.js # Commit changes