Skip to content

Commit 87ce2fc

Browse files
committed
Extract CI sync actions into their own file
1 parent a792b72 commit 87ce2fc

File tree

5 files changed

+105
-99
lines changed

5 files changed

+105
-99
lines changed

.github/workflows/dev.yml

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -441,64 +441,3 @@ jobs:
441441

442442
- name: Test
443443
run: bazelisk test //... --enable_runfiles --incompatible_strict_action_env --test_output=all
444-
445-
heron:
446-
# Job to verify that the tasks performed by UpdateAlways have been done. It is
447-
# the committer's responsibility (currently) to run UpdateAlways themselves when
448-
# making a PR, so that everything is kept in-sync.
449-
name: Check autogenerated file freshness
450-
runs-on: ubuntu-latest
451-
permissions:
452-
contents: write
453-
steps:
454-
- name: Checkout
455-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
456-
with:
457-
submodules: false
458-
fetch-depth: 0 # Necessary for maint/UpdateAlways
459-
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.event.pull_request.head.ref || github.ref }}
463-
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
464-
465-
- name: UpdateDates
466-
if: |
467-
github.event_name != 'pull_request' &&
468-
(startsWith(github.ref, 'refs/heads/release/') ||
469-
startsWith(github.ref, 'refs/tags/pcre2-'))
470-
run: maint/UpdateDates.py
471-
472-
- name: UpdateAlways
473-
run: maint/UpdateAlways
474-
475-
- name: 'Rebuild *.h.generic'
476-
run: |
477-
./autogen.sh && ./configure
478-
479-
# Workaround for incorrect filesystem permissions on /usr/share/aclocal, which
480-
# causes the m4 macros to be copied with incorrect permissions.
481-
# https://github.com/actions/runner-images/issues/11212
482-
chmod u=rw,go=r m4/*.m4
483-
484-
rm -f src/*.generic
485-
make src/config.h.generic src/pcre2.h.generic
486-
487-
# If we're in a forked repo, it's too onerous to expect contributors to run the
488-
# checks locally to keep these files up to date (since the tool versions are very
489-
# fussy and brittle).
490-
#
491-
# However, we still want to run the steps above, to check that the UpdateAlways
492-
# process is able to run to completion, since it can pick up errors in the man pages.
493-
494-
- name: Commit and push, if not in a forked repo
495-
if: github.event_name != 'pull_request' || ( ! github.event.pull_request.head.repo.fork && github.actor != 'dependabot[bot]' )
496-
run: |
497-
if [ -n "`git status --porcelain`" ] ; then
498-
# Dirty working tree: push it
499-
git config user.name "github-actions[bot]"
500-
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
501-
git add -u
502-
git commit -m "Sync autogenerated files #noupdate"
503-
git push
504-
fi

.github/workflows/pages.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ name: Deploy Pages
22
on:
33
workflow_dispatch:
44
workflow_run:
5-
workflows: [ 'Sync doc changes' ]
5+
workflows: [ 'Sync' ]
66
types:
77
- completed
8+
branches: [ master ]
89
push:
910
branches: [ pages ]
1011
pull_request:

.github/workflows/sync.yml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: Sync
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches: [ master, "release/**" ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
sync-autogenerated:
14+
# Job to verify that the tasks performed by UpdateAlways have been done. It is
15+
# the committer's responsibility (currently) to run UpdateAlways themselves when
16+
# making a PR, so that everything is kept in-sync.
17+
name: Check autogenerated file freshness
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: write
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
24+
with:
25+
submodules: false
26+
fetch-depth: 0 # Necessary for maint/UpdateAlways
27+
fetch-tags: false
28+
# Check out the unmerged source branch for `pull_request`-triggered runs;
29+
# otherwise use the tip of the branch for `workflow_dispatch` and `pull` triggers.
30+
ref: ${{ github.event.pull_request.head.ref || github.ref }}
31+
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
32+
33+
- name: UpdateDates
34+
if: |
35+
github.event_name != 'pull_request' &&
36+
(startsWith(github.ref, 'refs/heads/release/') ||
37+
startsWith(github.ref, 'refs/tags/pcre2-'))
38+
run: maint/UpdateDates.py
39+
40+
- name: UpdateAlways
41+
run: maint/UpdateAlways
42+
43+
- name: 'Rebuild *.h.generic'
44+
run: |
45+
./autogen.sh && ./configure
46+
47+
# Workaround for incorrect filesystem permissions on /usr/share/aclocal, which
48+
# causes the m4 macros to be copied with incorrect permissions.
49+
# https://github.com/actions/runner-images/issues/11212
50+
chmod u=rw,go=r m4/*.m4
51+
52+
rm -f src/*.generic
53+
make src/config.h.generic src/pcre2.h.generic
54+
55+
# If we're in a forked repo, it's too onerous to expect contributors to run the
56+
# checks locally to keep these files up to date (since the tool versions are very
57+
# fussy and brittle).
58+
#
59+
# However, we still want to run the steps above, to check that the UpdateAlways
60+
# process is able to run to completion, since it can pick up errors in the man pages.
61+
62+
- name: Commit and push, if not in a forked repo
63+
if: github.event_name != 'pull_request' || ( ! github.event.pull_request.head.repo.fork && github.actor != 'dependabot[bot]' )
64+
run: |
65+
if [ -n "`git status --porcelain`" ] ; then
66+
# Dirty working tree: push it
67+
git config user.name "github-actions[bot]"
68+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
69+
git add -u
70+
git commit -m "Sync autogenerated files #noupdate"
71+
git push
72+
fi
73+
74+
sync-docs:
75+
name: Sync content from master to pages
76+
runs-on: ubuntu-latest
77+
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master'
78+
needs: ['sync-autogenerated']
79+
permissions:
80+
contents: write
81+
steps:
82+
- name: Checkout
83+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
84+
with:
85+
submodules: false
86+
fetch-depth: 0 # Necessary to get both the master and pages branches
87+
fetch-tags: false
88+
ref: pages
89+
90+
- name: Commit and push, if docs have changed
91+
run: |
92+
if ! git diff --exit-code origin/master -- \
93+
./doc ./AUTHORS.md ./LICENCE.md ./SECURITY.md ./README.md \
94+
./README ./NON-AUTOTOOLS-BUILD >/dev/null ; then
95+
# Differences from master: merge and push
96+
git config user.name "github-actions[bot]"
97+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
98+
git merge origin/master --no-edit -m"Sync content from master to pages"
99+
git push
100+
else
101+
echo "No content changes to sync"
102+
fi

.github/workflows/syncpages.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

m4/pcre2_zos.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ AC_DEFUN([PCRE2_ZOS_FIXES],
4747
fi
4848
4949
fi
50-
])
50+
])

0 commit comments

Comments
 (0)