Skip to content

Commit

Permalink
Generate Examples Comment for PRs (#177)
Browse files Browse the repository at this point in the history
* ci: add stackblitz examples table

* ci: skip husky
  • Loading branch information
joe-bell committed Jun 29, 2023
1 parent 6186888 commit a8394dd
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .github/actions/install/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ runs:

- name: Install dependencies
shell: bash
env:
SKIP_INSTALL_HUSKY: 1
run: pnpm i --frozen-lockfile
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,33 @@ jobs:
fetch-depth: 0
- uses: ./.github/actions/install
- run: pnpm check
examples:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: ./.github/actions/install
- run: pnpm -rc --filter="./examples/**" exec -- pwd | awk -F/ '{print $NF}' > TMP_EXAMPLES.txt
- name: Generate Examples Comment
env:
BRANCH: ${{ github.event.pull_request.head.ref }}
run: >
{
echo "**The latest updates to examples.**";
echo "";
echo "| Name | StackBlitz |";
echo "|:---------|:------------|";
while IFS= read -r id || [[ -n "$id" ]];
do echo "| **$id** | [Visit StackBlitz](https://stackblitz.com/github/joe-bell/cva/tree/${BRANCH}/examples/${id}) |";
done;
} < TMP_EXAMPLES.txt > TMP_EXAMPLES.md
- uses: marocchino/sticky-pull-request-comment@v2
if: github.event_name == 'pull_request'
with:
header: "Examples"
recreate: true
path: TMP_EXAMPLES.md
lint:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"lint-staged": "lint-staged --config .config/lint-staged.config.mjs",
"preinstall": "npx only-allow pnpm",
"prepare": "run-p -s prepare:*",
"prepare:husky": "if-env VERCEL=1 && echo 'Skipping prepare' || husky install",
"prepare:husky": "if-env SKIP_INSTALL_HUSKY=1 && echo 'Skipping husky install' || husky install",
"prepare:packages": "pnpm build",
"prettier": "prettier --config .prettierrc.cjs --ignore-unknown --no-error-on-unmatched-pattern",
"syncpack": "syncpack list-mismatches --config .config/.syncpackrc",
Expand Down

1 comment on commit a8394dd

@vercel
Copy link

@vercel vercel bot commented on a8394dd Jun 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.