@@ -42,41 +42,46 @@ jobs:
4242 fi
4343 echo "::set-output name=numbers::$PR_LIST"
4444 PR_COUNT=$(echo "$PR_LIST" | wc -l)
45- echo "$PR_COUNT PR's to be merged: $PR_LIST "
45+ echo "$PR_COUNT PR's to be merged. "
4646
4747 - name : Merge PRs into new branch
4848 run : |
4949 NEW_BRANCH="dependabot-test-${{ steps.datetime.outputs.date }}"
5050 git checkout $NEW_BRANCH
51- PR_LIST=$(gh pr list --json number,headRefName --jq '.[] | "\(.number) \(.headRefName)"' | grep dependabot)
52- PR_LIST=$(echo "$PR_LIST" | tr -d '\r') # Remove trailing newline
53- echo "::set-output name=numbers::$PR_LIST"
54- PR_LINKS=""
5551 while IFS= read -r line; do
5652 IFS=' ' read -r PR_NUMBER BRANCH_NAME <<< "$line"
57- PR_URL="https://github.com/${GITHUB_REPOSITORY}/pull/$PR_NUMBER"
58- PR_LINKS+="\n• <$PR_URL|#${PR_NUMBER}: ${BRANCH_NAME}>"
5953 echo "Merging PR #$PR_NUMBER from branch $BRANCH_NAME into $NEW_BRANCH..."
6054 git fetch origin $BRANCH_NAME
6155 git merge --no-commit --allow-unrelated-histories --strategy-option=theirs origin/$BRANCH_NAME
6256 echo "Pushing changes to $NEW_BRANCH..."
6357 git commit -m "Merged PR #$PR_NUMBER into $NEW_BRANCH"
6458 git push origin $NEW_BRANCH
65- done <<< "$PR_LIST"
66- echo "::set-output name=pr_links::$PR_LINKS"
59+ done <<< "${{ steps.pr_list.outputs.numbers }}"
6760
6861 - name : Merge process status
6962 run : |
7063 echo "Merging process completed successfully!"
7164 echo "New branch name: dependabot-test-${{ steps.datetime.outputs.date }}"
7265
66+ - name : Generate PR links
67+ id : pr_links
68+ run : |
69+ PR_LINKS=""
70+ while IFS= read -r line; do
71+ IFS=' ' read -r PR_NUMBER BRANCH_NAME <<< "$line"
72+ PR_URL="https://github.com/${GITHUB_REPOSITORY}/pull/$PR_NUMBER"
73+ PR_LINKS+="\n• <$PR_URL|#${PR_NUMBER}: ${BRANCH_NAME}>"
74+ done <<< "${{ steps.pr_list.outputs.numbers }}"
75+
76+ echo "::set-output name=pr_links::$PR_LINKS"
77+
7378 - name : Post to a Slack channel
74797580 with :
7681 channel-id : ' C04E69NEDAT'
7782 payload : |
7883 {
79- "blocks": [
84+ "blocks": [
8085 {
8186 "type": "header",
8287 "text": {
@@ -92,14 +97,14 @@ jobs:
9297 "type": "section",
9398 "text": {
9499 "type": "mrkdwn",
95- "text": "*Testing Branch: *<https://github.com/BranchMetrics/ios-branch-deep-linking-attribution /tree/dependabot-test-${{ steps.datetime.outputs.date }}|dependabot-test-${{ steps.datetime.outputs.date }}>"
100+ "text": "*Testing Branch: *<https://github.com/${GITHUB_REPOSITORY} /tree/dependabot-test-${{ steps.datetime.outputs.date }}|dependabot-test-${{ steps.datetime.outputs.date }}>"
96101 }
97102 },
98103 {
99104 "type": "section",
100105 "text": {
101106 "type": "mrkdwn",
102- "text": "'${{ steps.merge_prs .outputs.pr_links }}'"
107+ "text": "'${{ steps.pr_links .outputs.pr_links }}'"
103108 }
104109 }
105110 ]
0 commit comments