Skip to content

Commit 4aa0008

Browse files
authored
Try new strategy for auto updates (#664)
I previously added a CI that the documentation was not dirty. This turns out to be too strict: it's onerous to have contributors install the exactly-matching `nroff` setup required to sync the documentation. Instead, the CI check now commits and pushes the change to the PR (if it's a same-fork PR), and ignores the changes if it's a PR from another fork. The CI will push the PrepareRelease changes on master, if needed. Fixes #653
1 parent 971de5f commit 4aa0008

File tree

3 files changed

+25
-12
lines changed

3 files changed

+25
-12
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ jobs:
291291
292292
# Workaround for incorrect filesystem permissions on /usr/share/aclocal, which
293293
# causes the m4 macros to be copied with incorrect permissions.
294+
# https://github.com/actions/runner-images/issues/11212
294295
chmod u=rw,go=r m4/*.m4
295296
296297
- name: Configure
@@ -303,7 +304,7 @@ jobs:
303304
run: |
304305
mkdir tarball-dir
305306
tar -C tarball-dir -xzf pcre2-*.tar.gz
306-
# Budge the directory, so we don't back the version number into the
307+
# Budge the directory, so we don't bake the version number into the
307308
# `manifest-tarball` file:
308309
mv tarball-dir/pcre2-* tarball-dir/pcre2-SNAPSHOT
309310
maint/RunManifestTest tarball-dir maint/manifest-tarball

.github/workflows/clang-analyzer.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ jobs:
2323
# turn aborts when it finds that GitHub's CI machine doesn't have ICU.
2424
# Just turn off localisation. A future version of the ubuntu-24.04 or
2525
# ubuntu-latest runners might not need this workaround.
26+
# https://github.com/actions/runner-images/issues/10989
2627
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: 1
2728

2829
steps:

.github/workflows/dev.yml

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -448,13 +448,18 @@ jobs:
448448
# making a PR, so that everything is kept in-sync.
449449
name: Check autogenerated file freshness
450450
runs-on: ubuntu-24.04 # TODO: Update to ubuntu-latest when that switches to 24.04
451+
permissions:
452+
contents: write
451453
steps:
452454
- name: Checkout
453455
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
454456
with:
455457
submodules: false
456-
fetch-depth: 0
458+
fetch-depth: 0 # Necessary for maint/PrepareRelease
457459
fetch-tags: false
460+
# Check out the unmerged source branch for `pull_request`-triggered runs;
461+
# otherwise use the tip of the branch for `workflow_dispatch` and `pull` triggers.
462+
ref: ${{ github.head_ref || github.ref }}
458463

459464
- name: PrepareRelease
460465
run: maint/PrepareRelease
@@ -465,15 +470,21 @@ jobs:
465470
rm -f src/*.generic
466471
make src/config.h.generic src/pcre2.h.generic
467472
468-
- name: Working directory clean
469-
run: |
473+
# If we're in a forked repo, it's too onerous to expect contributors to run the
474+
# checks locally to keep these files up to date (since the tool versions are very
475+
# fussy and brittle).
476+
#
477+
# However, we still want to run the steps above, to check that the PrepareRelease
478+
# process is able to run to completion, since it can pick up errors in the man pages.
479+
480+
- name: Commit and push, if not in a forked repo
481+
if: github.event_name != 'pull_request' || ( ! github.event.pull_request.head.repo.fork && github.actor != 'dependabot[bot]' )
482+
run: |
470483
if [ -n "`git status --porcelain`" ] ; then
471-
(
472-
echo "Dirty working tree! Affected files:"
473-
git status --porcelain || true
474-
echo ""
475-
echo "Diff:"
476-
git diff || true
477-
) >&2
478-
exit 1
484+
# Dirty working tree: push it
485+
git config user.name "github-actions[bot]"
486+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
487+
git add -u
488+
git commit -m "Sync autogenerated files"
489+
git push
479490
fi

0 commit comments

Comments
 (0)