11# Generates a list of changes and a commit message when the pinned gutenberg repository hash changes.
2- name : Detect Gutenberg SHA Change
2+ name : Generate changelog and commit message
33
44on :
5+ # This workflow was introduced in WordPress 7.0.
56 pull_request :
67 branches :
78 - trunk
@@ -21,7 +22,12 @@ concurrency:
2122permissions : {}
2223
2324jobs :
24- detect-sha-change :
25+ # Detects whether the gutenberg.sha value in the package.json file has changed.
26+ #
27+ # Performs the following steps:
28+ # - Checks out the repository.
29+ # - Check if the pinned hash has changed.
30+ detect-hash-change :
2531 name : Detect Gutenberg SHA change
2632 runs-on : ubuntu-24.04
2733 if : ${{ github.repository == 'wordpress/wordpress-develop' }}
@@ -58,11 +64,17 @@ jobs:
5864 echo "The pinned Gutenberg repository hash has not changed: $HEAD_GUTENBERG_SHA"
5965 fi
6066
67+ # Generates a list of changes between two specified hashes.
68+ #
69+ # Performs the following steps:
70+ # - Checks out the repository.
71+ # - Generates a list of changes.
72+ # - Uploads the changelog as an artifact.
6173 generate-changelog :
6274 name : Generate a list of changes between the hashes
6375 runs-on : ubuntu-24.04
64- needs : [ 'detect-sha -change' ]
65- if : ${{ needs.detect-sha -change.outputs.sha_changed == 'true' }}
76+ needs : [ 'detect-hash -change' ]
77+ if : ${{ needs.detect-hash -change.outputs.sha_changed == 'true' }}
6678 permissions :
6779 contents : read
6880 outputs :
7991 - name : Generate a list of changes
8092 id : change-list
8193 env :
82- BASE_SHA : ${{ needs.detect-sha -change.outputs.base_sha }}
83- HEAD_SHA : ${{ needs.detect-sha -change.outputs.head_sha }}
94+ BASE_SHA : ${{ needs.detect-hash -change.outputs.base_sha }}
95+ HEAD_SHA : ${{ needs.detect-hash -change.outputs.head_sha }}
8496 run : |
8597 git log --reverse --format="- %s" "$BASE_SHA".."$HEAD_SHA" | \
8698 sed 's|#\([0-9][0-9]*\)|https://github.com/WordPress/gutenberg/pull/\1|g; /github\.com\/WordPress\/gutenberg\/pull/!d' \
@@ -92,25 +104,38 @@ jobs:
92104 echo "has_changes=false" >> "$GITHUB_OUTPUT"
93105 fi
94106
95- - name : Upload changes artifact
107+ - name : Upload changelog as an artifact
96108 uses : actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
97109 with :
98110 path : changelog.txt
99-
100111 archive : false
112+
113+ # Drafts a commit message containing a detailed list of changes being merged.
114+ #
115+ # Performs the following steps:
116+ # - Downloads the changelog artifact.
117+ # - Builds a commit message.
118+ # - Uploads the commit message as an artifact.
101119 generate-commit-message :
102120 name : Generate commit message
103121 runs-on : ubuntu-24.04
104- needs : [ 'detect-sha -change', 'generate-changelog' ]
105- if : ${{ needs.detect-sha -change.outputs.sha_changed == 'true' }}
122+ needs : [ 'detect-hash -change', 'generate-changelog' ]
123+ if : ${{ needs.detect-hash -change.outputs.sha_changed == 'true' }}
106124 permissions :
107125 contents : read
108126
109127 steps :
128+ - name : Download changelog artifact
129+ if : ${{ needs.generate-changelog.outputs.has_changes == 'true' }}
130+ uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
131+ with :
132+ name : changelog.txt
133+ skip-decompress : true
134+
110135 - name : Build commit message
111136 env :
112- BASE_SHA : ${{ needs.detect-sha -change.outputs.base_sha }}
113- HEAD_SHA : ${{ needs.detect-sha -change.outputs.head_sha }}
137+ BASE_SHA : ${{ needs.detect-hash -change.outputs.base_sha }}
138+ HEAD_SHA : ${{ needs.detect-hash -change.outputs.head_sha }}
114139 HAS_CHANGES : ${{ needs.generate-changelog.outputs.has_changes }}
115140 run : |
116141 {
@@ -130,7 +155,7 @@ jobs:
130155 printf 'See #64595, #64393.\n'
131156 } > commit-message.md
132157
133- - name : Upload commit message artifact
158+ - name : Upload commit message as an artifact
134159 uses : actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
135160 with :
136161 path : commit-message.md
0 commit comments