Felipe
commited on
Fix PR preview workflow - remove broken live preview link (#10)
Browse files- .github/workflows/pr-preview.yml +15 -30
.github/workflows/pr-preview.yml
CHANGED
|
@@ -11,13 +11,13 @@ jobs:
|
|
| 11 |
permissions:
|
| 12 |
contents: read
|
| 13 |
pull-requests: write
|
| 14 |
-
|
| 15 |
steps:
|
| 16 |
- name: Checkout PR
|
| 17 |
uses: actions/checkout@v4
|
| 18 |
|
| 19 |
- name: Set up Python
|
| 20 |
-
uses: actions/setup-python@
|
| 21 |
with:
|
| 22 |
python-version: '3.x'
|
| 23 |
|
|
@@ -34,52 +34,37 @@ jobs:
|
|
| 34 |
path: index.html
|
| 35 |
retention-days: 7
|
| 36 |
|
| 37 |
-
- name: Deploy preview (if Pages enabled)
|
| 38 |
-
uses: peaceiris/actions-gh-pages@v4
|
| 39 |
-
continue-on-error: true
|
| 40 |
-
with:
|
| 41 |
-
github_token: ${{ secrets.GITHUB_TOKEN }}
|
| 42 |
-
publish_dir: .
|
| 43 |
-
destination_dir: pr-${{ github.event.number }}
|
| 44 |
-
keep_files: false
|
| 45 |
-
|
| 46 |
- name: Comment PR with preview link
|
| 47 |
-
uses: actions/github-script@
|
| 48 |
with:
|
| 49 |
script: |
|
| 50 |
const prNumber = context.payload.pull_request.number;
|
| 51 |
const repoOwner = context.repo.owner;
|
| 52 |
const repoName = context.repo.repo;
|
| 53 |
-
|
| 54 |
-
|
| 55 |
const comment = `## ๐ Website Preview
|
| 56 |
-
|
| 57 |
-
Your changes have been processed!
|
| 58 |
-
|
| 59 |
-
**๐ Preview Artifact:**
|
| 60 |
-
|
| 61 |
-
${previewUrl ? `**๐ Live Preview:** ${previewUrl}` : '**โน๏ธ Live preview:** GitHub Pages not configured for this repository.'}
|
| 62 |
-
|
| 63 |
---
|
| 64 |
-
|
| 65 |
-
### ๐ ๏ธ
|
| 66 |
\`\`\`bash
|
| 67 |
-
# Clone and test your changes
|
| 68 |
git checkout ${{ github.head_ref }}
|
| 69 |
-
python
|
| 70 |
-
python -m http.server 8000
|
| 71 |
-
# Visit: http://localhost:8000
|
| 72 |
\`\`\`
|
| 73 |
-
|
| 74 |
### โ
Validation Status:
|
| 75 |
- โ
Website generated successfully
|
| 76 |
- โ
Table format validated
|
| 77 |
- โ
Ready for review
|
| 78 |
`;
|
| 79 |
-
|
| 80 |
github.rest.issues.createComment({
|
| 81 |
issue_number: prNumber,
|
| 82 |
owner: repoOwner,
|
| 83 |
repo: repoName,
|
| 84 |
body: comment
|
| 85 |
-
});
|
|
|
|
| 11 |
permissions:
|
| 12 |
contents: read
|
| 13 |
pull-requests: write
|
| 14 |
+
|
| 15 |
steps:
|
| 16 |
- name: Checkout PR
|
| 17 |
uses: actions/checkout@v4
|
| 18 |
|
| 19 |
- name: Set up Python
|
| 20 |
+
uses: actions/setup-python@v5
|
| 21 |
with:
|
| 22 |
python-version: '3.x'
|
| 23 |
|
|
|
|
| 34 |
path: index.html
|
| 35 |
retention-days: 7
|
| 36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
- name: Comment PR with preview link
|
| 38 |
+
uses: actions/github-script@v7
|
| 39 |
with:
|
| 40 |
script: |
|
| 41 |
const prNumber = context.payload.pull_request.number;
|
| 42 |
const repoOwner = context.repo.owner;
|
| 43 |
const repoName = context.repo.repo;
|
| 44 |
+
|
|
|
|
| 45 |
const comment = `## ๐ Website Preview
|
| 46 |
+
|
| 47 |
+
Your changes have been processed!
|
| 48 |
+
|
| 49 |
+
**๐ Preview Artifact:** Download the "website-preview" artifact from the Actions tab to view the generated HTML.
|
| 50 |
+
|
|
|
|
|
|
|
| 51 |
---
|
| 52 |
+
|
| 53 |
+
### ๐ ๏ธ Test locally:
|
| 54 |
\`\`\`bash
|
|
|
|
| 55 |
git checkout ${{ github.head_ref }}
|
| 56 |
+
python scripts/dev-preview.py
|
|
|
|
|
|
|
| 57 |
\`\`\`
|
| 58 |
+
|
| 59 |
### โ
Validation Status:
|
| 60 |
- โ
Website generated successfully
|
| 61 |
- โ
Table format validated
|
| 62 |
- โ
Ready for review
|
| 63 |
`;
|
| 64 |
+
|
| 65 |
github.rest.issues.createComment({
|
| 66 |
issue_number: prNumber,
|
| 67 |
owner: repoOwner,
|
| 68 |
repo: repoName,
|
| 69 |
body: comment
|
| 70 |
+
});
|