Skip to content

Commit 3d08b83

Browse files
authored
Adjust automation PR title (#609)
1 parent 6058f12 commit 3d08b83

2 files changed

Lines changed: 22 additions & 3 deletions

File tree

.github/workflows/intercom-sdk-check.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,24 @@ jobs:
2727
env:
2828
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2929

30+
- name: Determine PR title
31+
id: pr
32+
if: steps.sdk.outputs.updates_available == 'true'
33+
run: |
34+
if [[ "${{ steps.sdk.outputs.android_updated }}" == "true" && "${{ steps.sdk.outputs.ios_updated }}" == "true" ]]; then
35+
echo "title=Update intercom-android ${{ steps.sdk.outputs.android_version }} and intercom-ios ${{ steps.sdk.outputs.ios_version }}" >> "$GITHUB_OUTPUT"
36+
elif [[ "${{ steps.sdk.outputs.android_updated }}" == "true" ]]; then
37+
echo "title=Update intercom-android ${{ steps.sdk.outputs.android_version }}" >> "$GITHUB_OUTPUT"
38+
else
39+
echo "title=Update intercom-ios ${{ steps.sdk.outputs.ios_version }}" >> "$GITHUB_OUTPUT"
40+
fi
41+
3042
- name: Create pull request
43+
if: steps.sdk.outputs.updates_available == 'true'
3144
uses: peter-evans/create-pull-request@v6
3245
with:
33-
commit-message: 'Update Intercom SDK versions to ${{ steps.sdk.outputs.android_version }} for Android and ${{ steps.sdk.outputs.ios_version }} for iOS'
34-
title: 'Update Intercom SDK versions to ${{ steps.sdk.outputs.android_version }} for Android and ${{ steps.sdk.outputs.ios_version }} for iOS'
46+
commit-message: ${{ steps.pr.outputs.title }}
47+
title: ${{ steps.pr.outputs.title }}
3548
body: |
3649
Automated Intercom SDK update.
3750

scripts/check_intercom_sdk_updates.dart

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,11 @@ String _updateChangelog(String contents, String version, List<String> entries) {
144144
updatedLines.add('');
145145
updatedLines.addAll(newEntries);
146146
updatedLines.add('');
147-
updatedLines.addAll(lines.skip(insertIndex + 1));
147+
var remainderStart = insertIndex + 1;
148+
while (remainderStart < lines.length && lines[remainderStart].trim().isEmpty) {
149+
remainderStart++;
150+
}
151+
updatedLines.addAll(lines.skip(remainderStart));
148152
return updatedLines.join('\n');
149153
}
150154

@@ -206,6 +210,8 @@ Future<void> main(List<String> args) async {
206210
_writeGithubOutputs({
207211
'android_version': latestAndroid,
208212
'ios_version': latestIos,
213+
'android_updated': shouldUpdateAndroid.toString(),
214+
'ios_updated': shouldUpdateIos.toString(),
209215
'plugin_version': nextPluginVersion,
210216
'updates_available': shouldUpdate.toString(),
211217
});

0 commit comments

Comments
 (0)