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
0 commit comments