Skip to content

Commit 12edc90

Browse files
paulirwinclaude
andcommitted
Build docs and website on pull requests without publishing
Add a pull_request trigger to both the documentation and website workflows, scoped to the paths that affect each build plus the workflow file itself, so changes to these builds can be validated in CI before they are merged. The steps that check out the site repo, copy the built output, and open a pull request against it are skipped for pull_request events, so a PR build never publishes anywhere. The website job's upstream-only guard is relaxed for pull requests; without this, PR builds from forks would be skipped entirely. Push and workflow_dispatch on a fork remain blocked as before. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent d3aef7c commit 12edc90

2 files changed

Lines changed: 27 additions & 2 deletions

File tree

.github/workflows/Lucene-Net-Documentation.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ name: 'Lucene.Net.Documentation'
3232

3333
on:
3434
workflow_dispatch:
35+
# 2026-08-09 - build (but do not publish) the API docs for any pull request that touches the docs sources, the docs
36+
# plugins, or this workflow file. This lets changes to the docs build be validated in CI before they are merged.
37+
# The steps that push to the site repo are skipped for pull requests - see the `if:` conditions below.
38+
pull_request:
39+
paths:
40+
- 'websites/apidocs/**/*'
41+
- 'src/docs/LuceneDocsPlugins/**/*'
42+
- '.github/workflows/Lucene-Net-Documentation.yml'
3543
push:
3644
# 2026-06-23 - when both tags and branches are used, they are ORed. However, note that when paths is used, it is ANDed to each of them.
3745
tags:
@@ -188,13 +196,15 @@ jobs:
188196
path: '${{github.workspace}}/main-repo/websites/apidocs/_site'
189197

190198
- name: Checkout Lucene.Net website
199+
if: ${{ github.event_name != 'pull_request' }}
191200
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
192201
with:
193202
repository: ${{ env.SITE_REPO }}
194203
ref: asf-site
195204
path: website-repo
196205

197206
- name: Copy documentation site files
207+
if: ${{ github.event_name != 'pull_request' }}
198208
run: |
199209
$source = "$Env:GITHUB_WORKSPACE\main-repo\websites\apidocs\_site"
200210
$dest = "$Env:GITHUB_WORKSPACE\website-repo\docs\$Env:RELEASE_VERSION"
@@ -212,6 +222,7 @@ jobs:
212222
# Because we are always building the docs against a consistent version
213223
- name: Create Pull Request
214224
id: cpr
225+
if: ${{ github.event_name != 'pull_request' }}
215226
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
216227
with:
217228
token: ${{ secrets.LUCENE_NET_WEBSITE_BUILD }}
@@ -227,6 +238,7 @@ jobs:
227238
- For version ${{ env.RELEASE_VERSION }}
228239
229240
- name: Check outputs
241+
if: ${{ github.event_name != 'pull_request' }}
230242
run: |
231243
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
232244
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"

.github/workflows/Lucene-Net-Website.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ name: 'Lucene.Net.Website'
2828

2929
on:
3030
workflow_dispatch:
31+
# 2026-08-09 - build (but do not publish) the website for any pull request that touches the website sources or this
32+
# workflow file. This lets changes to the website build be validated in CI before they are merged. The steps that push
33+
# to the site repo are skipped for pull requests - see the `if:` conditions below.
34+
pull_request:
35+
paths:
36+
- 'websites/site/**/*'
37+
- '.github/workflows/Lucene-Net-Website.yml'
3138
push:
3239
# 2026-06-23 - when only tags and paths are used, they are ANDed together, not ORed, so the presence of a Website_* tag blocked the automation from triggering.
3340
# Howevever, if both tags and branches are present then we have 1) tags AND paths OR 2) branches AND paths. So, we need to specify them all if we want either or.
@@ -49,8 +56,10 @@ env:
4956

5057
jobs:
5158
build:
52-
# CRITICAL FIX: Only run this job if it is executing on the main upstream repository
53-
if: github.repository == 'apache/lucenenet'
59+
# CRITICAL FIX: Only run this job if it is executing on the main upstream repository, so that forks do not attempt
60+
# to build and publish the website. Pull requests are exempt because they only build - the steps that publish to the
61+
# site repo are skipped for pull requests (see the `if:` conditions below).
62+
if: ${{ github.repository == 'apache/lucenenet' || github.event_name == 'pull_request' }}
5463
runs-on: windows-latest
5564
steps:
5665

@@ -119,6 +128,7 @@ jobs:
119128
path: '${{github.workspace}}/main-repo/websites/site/_site'
120129

121130
- name: Checkout Lucene.Net website
131+
if: ${{ github.event_name != 'pull_request' }}
122132
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
123133
with:
124134
repository: ${{ env.SITE_REPO }}
@@ -127,11 +137,13 @@ jobs:
127137
persist-credentials: false
128138

129139
- name: Copy website files
140+
if: ${{ github.event_name != 'pull_request' }}
130141
run: Get-ChildItem -Path "$Env:GITHUB_WORKSPACE\main-repo\websites\site\_site" | Copy-Item -Destination "$Env:GITHUB_WORKSPACE\website-repo" -Recurse -Force
131142
shell: powershell
132143

133144
- name: Create Pull Request
134145
id: cpr
146+
if: ${{ github.event_name != 'pull_request' }}
135147
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
136148
with:
137149
token: ${{ secrets.LUCENE_NET_WEBSITE_BUILD }}
@@ -147,6 +159,7 @@ jobs:
147159
For release version ${{ env.RELEASE_VERSION }}
148160
149161
- name: Check outputs
162+
if: ${{ github.event_name != 'pull_request' }}
150163
run: |
151164
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
152165
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"

0 commit comments

Comments
 (0)