Skip to content

Commit a2661a9

Browse files
authored
ci: fix for idempotent preview comments (#183)
1 parent a9675dc commit a2661a9

File tree

2 files changed

+31
-18
lines changed

2 files changed

+31
-18
lines changed

.github/workflows/preview.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ jobs:
2323
- name: Setup Node.js
2424
uses: actions/setup-node@v3
2525
with:
26-
node-version: '18'
27-
cache: 'yarn'
26+
node-version: "18"
27+
cache: "yarn"
2828

2929
- name: Install dependencies
3030
run: yarn install --frozen-lockfile
@@ -39,30 +39,34 @@ jobs:
3939
run: yarn build
4040

4141
- name: Deploy to Netlify
42+
id: netlify
4243
env:
4344
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
4445
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
4546
run: |
46-
netlify deploy \
47+
PREVIEW_URL=$(netlify deploy \
4748
--dir=build \
4849
--no-build \
4950
--auth=$NETLIFY_AUTH_TOKEN \
5051
--site=$NETLIFY_SITE_ID \
5152
--alias=preview-${{ github.event.pull_request.number }} \
52-
--message="Preview Deploy from GitHub Actions"
53+
--message="Preview Deploy from GitHub Actions" \
54+
--json | jq -r '.deploy_url')
55+
echo "NETLIFY_PREVIEW_URL=$PREVIEW_URL" >> $GITHUB_ENV
5356
5457
- name: "Update PR"
55-
if: success()
58+
if: env.NETLIFY_PREVIEW_URL
5659
uses: thollander/actions-comment-pull-request@v2
5760
with:
5861
message: |
5962
:rocket: **Build success!**
6063
61-
Latest successful preview: https://preview-${{ github.event.pull_request.number }}--questdb-documentation.netlify.app
64+
Latest successful preview: ${{ env.NETLIFY_PREVIEW_URL }}
6265
6366
Commit SHA: ${{ github.event.pull_request.head.sha }}
6467
6568
> :package: Build generates a preview & updates link on each commit.
69+
comment_tag: preview
6670

6771
validate-links:
6872
name: "Validate broken links"
@@ -77,8 +81,8 @@ jobs:
7781
- name: Setup Node.js
7882
uses: actions/setup-node@v3
7983
with:
80-
node-version: '18'
81-
cache: 'yarn'
84+
node-version: "18"
85+
cache: "yarn"
8286

8387
- name: Install dependencies
8488
run: yarn install --frozen-lockfile

README.md

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# QuestDB Documentation
22

3-
Uses [Docusaurus](https://docusaurus.io/).
3+
Uses [Docusaurus](https://docusaurus.io/).
44

55
## Quick start
66

@@ -31,7 +31,7 @@ Most changes are reflected live without having to restart the server.
3131
docker-compose up
3232
```
3333

34-
## Contributing
34+
## Contributing
3535

3636
You'll need to sign a quick CLA.
3737

@@ -49,23 +49,26 @@ Then push your branch to GitHub and create a PR.
4949

5050
We'll review the PR and generate a preview build.
5151

52-
A QuestDB member must add the `preview` label to your PR to deploy a preview build.
52+
A QuestDB member must add the `preview` label to your PR to deploy a preview
53+
build.
5354

5455
Once it looks good, we'll merge!
5556

56-
### Enhancements, bugs, typos
57+
### Enhancements, bugs, typos
5758

5859
We'd love your help!
5960

60-
Raise a [GH issue](https://github.com/questdb/documentation/issues/new/choose) or tackle a PR.
61+
Raise a [GH issue](https://github.com/questdb/documentation/issues/new/choose)
62+
or tackle a PR.
6163

6264
## Syntax
6365

6466
### Railroad diagrams
6567

6668
Our SQL syntax diagrams are created using Railroad.
6769

68-
To create a diagram, use the [Railroad online editor](https://www.bottlecaps.de/rr/ui) to see it rendered.
70+
To create a diagram, use the
71+
[Railroad online editor](https://www.bottlecaps.de/rr/ui) to see it rendered.
6972

7073
Once you're happy with it, copy the Railroad syntax and add it to:
7174

@@ -90,19 +93,21 @@ For example:
9093
python3 scripts/railroad.py renameTable
9194
```
9295

93-
During its final output, a markdown image with the appropriate syntax is printed:
96+
During its final output, a markdown image with the appropriate syntax is
97+
printed:
9498

9599
```text
96100
Copy the image syntax below and paste it into your markdown file:
97101
![Diagram for renameTable](/images/docs/diagrams/renameTable.svg)
98102
```
99103

100-
Copy this syntax and paste it into the markdown file where you want the diagram to appear.
104+
Copy this syntax and paste it into the markdown file where you want the diagram
105+
to appear.
101106

102107
The script requires:
103108

104-
* Java (to run the `rr.war` file)
105-
* Python (to execute the `railroad.py` script)
109+
- Java (to run the `rr.war` file)
110+
- Python (to execute the `railroad.py` script)
106111

107112
### Math Expressions
108113

@@ -189,3 +194,7 @@ On top of this, we follow the rules set by the
189194

190195
You do not need to run the linting task manually, Webpack will take care of that
191196
for you.
197+
198+
In your editor, turn on "format on save".
199+
200+
It'll help!

0 commit comments

Comments
 (0)