Skip to content

Commit

Permalink
Try new strategy for auto updates (#664)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
NWilson authored Jan 12, 2025
1 parent 971de5f commit 4aa0008
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ jobs:
# Workaround for incorrect filesystem permissions on /usr/share/aclocal, which
# causes the m4 macros to be copied with incorrect permissions.
# https://github.com/actions/runner-images/issues/11212
chmod u=rw,go=r m4/*.m4
- name: Configure
Expand All @@ -303,7 +304,7 @@ jobs:
run: |
mkdir tarball-dir
tar -C tarball-dir -xzf pcre2-*.tar.gz
# Budge the directory, so we don't back the version number into the
# Budge the directory, so we don't bake the version number into the
# `manifest-tarball` file:
mv tarball-dir/pcre2-* tarball-dir/pcre2-SNAPSHOT
maint/RunManifestTest tarball-dir maint/manifest-tarball
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/clang-analyzer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
# turn aborts when it finds that GitHub's CI machine doesn't have ICU.
# Just turn off localisation. A future version of the ubuntu-24.04 or
# ubuntu-latest runners might not need this workaround.
# https://github.com/actions/runner-images/issues/10989
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: 1

steps:
Expand Down
33 changes: 22 additions & 11 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -448,13 +448,18 @@ jobs:
# making a PR, so that everything is kept in-sync.
name: Check autogenerated file freshness
runs-on: ubuntu-24.04 # TODO: Update to ubuntu-latest when that switches to 24.04
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
submodules: false
fetch-depth: 0
fetch-depth: 0 # Necessary for maint/PrepareRelease
fetch-tags: false
# Check out the unmerged source branch for `pull_request`-triggered runs;
# otherwise use the tip of the branch for `workflow_dispatch` and `pull` triggers.
ref: ${{ github.head_ref || github.ref }}

- name: PrepareRelease
run: maint/PrepareRelease
Expand All @@ -465,15 +470,21 @@ jobs:
rm -f src/*.generic
make src/config.h.generic src/pcre2.h.generic
- name: Working directory clean
run: |
# If we're in a forked repo, it's too onerous to expect contributors to run the
# checks locally to keep these files up to date (since the tool versions are very
# fussy and brittle).
#
# However, we still want to run the steps above, to check that the PrepareRelease
# process is able to run to completion, since it can pick up errors in the man pages.

- name: Commit and push, if not in a forked repo
if: github.event_name != 'pull_request' || ( ! github.event.pull_request.head.repo.fork && github.actor != 'dependabot[bot]' )
run: |
if [ -n "`git status --porcelain`" ] ; then
(
echo "Dirty working tree! Affected files:"
git status --porcelain || true
echo ""
echo "Diff:"
git diff || true
) >&2
exit 1
# Dirty working tree: push it
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add -u
git commit -m "Sync autogenerated files"
git push
fi

0 comments on commit 4aa0008

Please sign in to comment.