From 6bb9122ae17921e8967cbdb90fce60be34327850 Mon Sep 17 00:00:00 2001 From: Eduardo Date: Tue, 14 May 2024 13:28:43 +0100 Subject: [PATCH 01/16] C2 (#48) * c1 (#47) * c2 --- app.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app.js b/app.js index 8455df7..0bc0747 100644 --- a/app.js +++ b/app.js @@ -5,5 +5,7 @@ function sum(a, b) { function subtract(a, b) { return a - b; } - + console.log('c1') + console.log('c2') + module.exports = { sum, subtract }; \ No newline at end of file From 1368394ceee3655c36e9ea3b336159a86eaacf38 Mon Sep 17 00:00:00 2001 From: Eduardo Date: Tue, 14 May 2024 13:29:37 +0100 Subject: [PATCH 02/16] Revert "C2 (#48)" (#50) This reverts commit 6bb9122ae17921e8967cbdb90fce60be34327850. --- app.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app.js b/app.js index 0bc0747..8455df7 100644 --- a/app.js +++ b/app.js @@ -5,7 +5,5 @@ function sum(a, b) { function subtract(a, b) { return a - b; } - console.log('c1') - console.log('c2') - + module.exports = { sum, subtract }; \ No newline at end of file From 6fba553fd50d72d1bbb9fc3ddc9eb4763dda948e Mon Sep 17 00:00:00 2001 From: Eduardo Date: Tue, 14 May 2024 14:32:49 +0100 Subject: [PATCH 03/16] Release 4 (#52) --- .../release-notification-pr-synchronize.yml | 63 +++++++++++-------- app.js | 5 +- 2 files changed, 41 insertions(+), 27 deletions(-) diff --git a/.github/workflows/release-notification-pr-synchronize.yml b/.github/workflows/release-notification-pr-synchronize.yml index 0566d04..262ef76 100644 --- a/.github/workflows/release-notification-pr-synchronize.yml +++ b/.github/workflows/release-notification-pr-synchronize.yml @@ -17,10 +17,13 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | comments_url=$(jq -r .pull_request.comments_url "$GITHUB_EVENT_PATH") - message_ts=$(curl -s -H "Authorization: token $GITHUB_TOKEN" $comments_url | jq -r '.[] | select(.body | startswith("Slack message_ts:")) | .body' | awk '{print $3}') + echo "Comments URL: $comments_url" + comment=$(curl -s -H "Authorization: token $GITHUB_TOKEN" "$comments_url" | jq -r '.[] | select(.body | startswith("Slack message_ts:"))') + message_ts=$(echo "$comment" | grep -oP 'Slack message_ts: \K\S+') + echo "Retrieved message_ts: $message_ts" echo "message_ts=$message_ts" >> $GITHUB_ENV - - name: Fetch and send commit messages to Slack + - name: Fetch and send new commit message to Slack env: SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -46,28 +49,36 @@ jobs: commits_url=$(jq -r .pull_request.commits_url "$GITHUB_EVENT_PATH") repo_url=$(jq -r .repository.html_url "$GITHUB_EVENT_PATH") - commits=$(curl -s -H "Authorization: token $GITHUB_TOKEN" $commits_url) - commit_messages="" - for row in $(echo "${commits}" | jq -r '.[] | @base64'); do - _jq() { - echo ${row} | base64 --decode | jq -r ${1} - } - commit_message=$(_jq '.commit.message') - commit_sha=$(_jq '.sha') - commit_author=$(_jq '.commit.author.name') - commit_url="$repo_url/commit/$commit_sha" - github_user=$(_jq '.author.login') - slack_user=${github_to_slack_map[$github_user]} - if [ -z "$slack_user" ]; then - slack_user=$commit_author - fi - commit_messages="$commit_messages- <$commit_url|$commit_message> by $slack_user\n" - done - if [ -z "$commit_messages" ]; then - commit_messages="No commits found." + latest_commit=$(curl -s -H "Authorization: token $GITHUB_TOKEN" $commits_url | jq -r '.[-1] | @base64') + + if [ -z "$latest_commit" ]; then + echo "No new commit found." + exit 0 fi - curl -s -X POST -H "Authorization: Bearer $SLACK_BOT_TOKEN" -H 'Content-type: application/json' --data "{ - \"channel\": \"$SLACK_CHANNEL\", - \"text\": \"New commits added to the release pull request:\n$commit_messages\", - \"thread_ts\": \"$message_ts\" - }" https://slack.com/api/chat.postMessage + + _jq() { + echo ${latest_commit} | base64 --decode | jq -r ${1} + } + commit_message=$(_jq '.commit.message') + commit_sha=$(_jq '.sha') + commit_author=$(_jq '.commit.author.name') + commit_url="$repo_url/commit/$commit_sha" + github_user=$(_jq '.author.login') + slack_user=${github_to_slack_map[$github_user]} + if [ -z "$slack_user" ]; then + slack_user=$commit_author + fi + commit_message_formatted="<$commit_url|$commit_message> by $slack_user" + + if [ -z "$commit_message_formatted" ]; then + commit_message_formatted="No new commits found." + fi + echo "Commit message: $commit_message_formatted" + + payload=$(jq -n --arg channel "$SLACK_CHANNEL" --arg text "New commit added: $commit_message_formatted" --arg thread_ts "$message_ts" '{ + channel: $channel, + text: $text, + thread_ts: $thread_ts + }') + echo "Payload: $payload" + curl -s -X POST -H "Authorization: Bearer $SLACK_BOT_TOKEN" -H 'Content-type: application/json' --data "$payload" https://slack.com/api/chat.postMessage diff --git a/app.js b/app.js index 8455df7..9889bb1 100644 --- a/app.js +++ b/app.js @@ -5,5 +5,8 @@ function sum(a, b) { function subtract(a, b) { return a - b; } - + console.log('c1') + console.log('c2') + console.log('c3') + module.exports = { sum, subtract }; \ No newline at end of file From c531202930a951778372f3acb2b0645c3c9b3345 Mon Sep 17 00:00:00 2001 From: Eduardo Date: Tue, 14 May 2024 15:17:04 +0100 Subject: [PATCH 04/16] Release 5 (#62) * release5 * trying to fix * release commits * release another try * work work work * work please * last try --- .../release-notification-pr-opened.yml | 27 ++++++++++--------- .../release-notification-pr-synchronize.yml | 9 +++---- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/release-notification-pr-opened.yml b/.github/workflows/release-notification-pr-opened.yml index 8735158..b86e0ba 100644 --- a/.github/workflows/release-notification-pr-opened.yml +++ b/.github/workflows/release-notification-pr-opened.yml @@ -22,6 +22,9 @@ jobs: pr_url=$(jq -r .pull_request.html_url "$GITHUB_EVENT_PATH") branch_name=$(jq -r .pull_request.head.ref "$GITHUB_EVENT_PATH") target_branch=$(jq -r .pull_request.base.ref "$GITHUB_EVENT_PATH") + pr_number=$(jq -r .pull_request.number "$GITHUB_EVENT_PATH") + pr_body=$(jq -r .pull_request.body "$GITHUB_EVENT_PATH") + initial_message_response=$(curl -s -X POST -H "Authorization: Bearer $SLACK_BOT_TOKEN" -H 'Content-type: application/json' --data "{ \"channel\": \"$SLACK_CHANNEL\", \"text\": \"New release pull request created: <$pr_url|$pr_title>\nBranch: $branch_name -> $target_branch\" @@ -30,14 +33,12 @@ jobs: if echo "$initial_message_response" | jq -e .ok > /dev/null; then message_ts=$(echo "$initial_message_response" | jq -r .ts) echo "Message TS: $message_ts" - echo "message_ts=$message_ts" >> $GITHUB_ENV - issue_number=$(jq -r .pull_request.number "$GITHUB_EVENT_PATH") - comment_url="$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/issues/$issue_number/comments" - echo "Comment URL: $comment_url" - comment_response=$(curl -s -X POST -H "Authorization: token $GITHUB_TOKEN" -H 'Content-Type: application/json' --data "{ - \"body\": \"Slack message_ts: $message_ts\" - }" "$comment_url") - echo "Comment response: $comment_response" + new_pr_body="Slack message_ts: ${message_ts}\n\n${pr_body}" + new_pr_body=$(echo -e "$new_pr_body") + echo "New PR body: $new_pr_body" + + update_pr_response=$(curl -s -X PATCH -H "Authorization: token $GITHUB_TOKEN" -H "Content-Type: application/json" --data "$(jq -n --arg body "$new_pr_body" '{body: $body}')" "$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/pulls/$pr_number") + echo "Update PR response: $update_pr_response" else echo "Failed to retrieve message_ts" exit 1 @@ -49,12 +50,12 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SLACK_CHANNEL: 'C05PW7HGP36' # Replace with your Slack channel ID run: | - comments_url=$(jq -r .pull_request.comments_url "$GITHUB_EVENT_PATH") - echo "Comments URL: $comments_url" - message_ts=$(curl -s -H "Authorization: token $GITHUB_TOKEN" "$comments_url" | jq -r '.[] | select(.body | startswith("Slack message_ts:")) | .body' | awk '{print $3}') + pr_number=$(jq -r .pull_request.number "$GITHUB_EVENT_PATH") + pr_body=$(curl -s -H "Authorization: token $GITHUB_TOKEN" "$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/pulls/$pr_number" | jq -r .body) + message_ts=$(echo "$pr_body" | grep -oP 'Slack message_ts: \K\S+') echo "Retrieved message_ts: $message_ts" if [ -z "$message_ts" ]; then - echo "Error: No message_ts found in pull request comments." + echo "Error: No message_ts found in pull request description." exit 1 fi @@ -102,4 +103,4 @@ jobs: \"channel\": \"$SLACK_CHANNEL\", \"text\": \"Commits in this pull request:\n$commit_messages\", \"thread_ts\": \"$message_ts\" - }" https://slack.com/api/chat.postMessage \ No newline at end of file + }" https://slack.com/api/chat.postMessage diff --git a/.github/workflows/release-notification-pr-synchronize.yml b/.github/workflows/release-notification-pr-synchronize.yml index 262ef76..ca54c96 100644 --- a/.github/workflows/release-notification-pr-synchronize.yml +++ b/.github/workflows/release-notification-pr-synchronize.yml @@ -12,14 +12,13 @@ jobs: - name: Install jq run: sudo apt-get install -y jq - - name: Fetch message_ts from comments + - name: Fetch `thread_ts` from PR description env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - comments_url=$(jq -r .pull_request.comments_url "$GITHUB_EVENT_PATH") - echo "Comments URL: $comments_url" - comment=$(curl -s -H "Authorization: token $GITHUB_TOKEN" "$comments_url" | jq -r '.[] | select(.body | startswith("Slack message_ts:"))') - message_ts=$(echo "$comment" | grep -oP 'Slack message_ts: \K\S+') + pr_number=$(jq -r .pull_request.number "$GITHUB_EVENT_PATH") + pr_body=$(curl -s -H "Authorization: token $GITHUB_TOKEN" "$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/pulls/$pr_number" | jq -r .body) + message_ts=$(echo "$pr_body" | grep -oP '^Slack message_ts: \K\S+') echo "Retrieved message_ts: $message_ts" echo "message_ts=$message_ts" >> $GITHUB_ENV From f0174b449b503a2523972610d2ee35ba17255861 Mon Sep 17 00:00:00 2001 From: Eduardo Date: Tue, 14 May 2024 15:45:50 +0100 Subject: [PATCH 05/16] Release v457 (#63) --- .github/workflows/release-notification-pr-synchronize.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release-notification-pr-synchronize.yml b/.github/workflows/release-notification-pr-synchronize.yml index ca54c96..e6bc75e 100644 --- a/.github/workflows/release-notification-pr-synchronize.yml +++ b/.github/workflows/release-notification-pr-synchronize.yml @@ -81,3 +81,4 @@ jobs: }') echo "Payload: $payload" curl -s -X POST -H "Authorization: Bearer $SLACK_BOT_TOKEN" -H 'Content-type: application/json' --data "$payload" https://slack.com/api/chat.postMessage + \ No newline at end of file From 5d11dbdab81b9789e9a8003400c787303f146acb Mon Sep 17 00:00:00 2001 From: Eduardo Date: Mon, 3 Jun 2024 11:27:46 +0100 Subject: [PATCH 06/16] add action (#81) --- .github/workflows/main.yml | 57 ++-------- .../release-notification-pr-opened.yml | 106 ------------------ .../release-notification-pr-synchronize.yml | 84 -------------- .github/workflows/sync.yml | 24 ---- 4 files changed, 8 insertions(+), 263 deletions(-) delete mode 100644 .github/workflows/release-notification-pr-opened.yml delete mode 100644 .github/workflows/release-notification-pr-synchronize.yml delete mode 100644 .github/workflows/sync.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cfcc22a..82e98bb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,58 +1,17 @@ -name: Code Coverage +name: Release Slack Notifications on: pull_request: - branches: - - main - - develop - push: - branches: - - main + types: [opened, synchronize, closed] jobs: - - checks: + slack_notification: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Use Node.js v20.9.0 - uses: actions/setup-node@v3 - with: - node-version: '20.9.0' - - - name: Install dependencies - run: yarn - - - name: Restore Coverage Report (from main) - if: github.ref != 'refs/heads/main' - uses: actions/cache/restore@v4 - with: - path: ./coverage/lcov.info - key: test-coverage-latest-main - - - name: Rename restored coverage report - if: github.ref != 'refs/heads/main' - run: mv ./coverage/lcov.info ./lcov-base.info - - - name: Run test coverage - run: npm run coverage - - - name: Cache Coverage Report (to main) - if: github.ref == 'refs/heads/main' - uses: actions/cache@v3 - with: - path: ./coverage/lcov.info - key: test-coverage-latest-main - - name: Generate Code Coverage report - if: github.ref != 'refs/heads/main' - id: code-coverage - uses: barecheck/code-coverage-action@v1 + - name: Send Slack notification + uses: duckdum/slack-release-notifications@v1.0.3 with: - barecheck-github-app-token: ${{ secrets.BARECHECK_GITHUB_APP_TOKEN }} - github-token: ${{ secrets.GITHUB_TOKEN }} - lcov-file: "./coverage/lcov.info" - base-lcov-file: "./lcov-base.info" - minimum-ratio: 50 - send-summary-comment: true - show-annotations: "warning" \ No newline at end of file + slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }} + slack-channel: 'C05PW7HGP36' + github-token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/release-notification-pr-opened.yml b/.github/workflows/release-notification-pr-opened.yml deleted file mode 100644 index b86e0ba..0000000 --- a/.github/workflows/release-notification-pr-opened.yml +++ /dev/null @@ -1,106 +0,0 @@ -name: Release Notification on PR Opened - -on: - pull_request: - types: [opened, reopened] - -jobs: - notify: - if: startsWith(github.event.pull_request.head.ref, 'release-') - runs-on: ubuntu-latest - steps: - - name: Install jq - run: sudo apt-get install -y jq - - - name: Send initial message to Slack - env: - SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} - SLACK_CHANNEL: 'C05PW7HGP36' # Replace with your Slack channel ID - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - pr_title=$(jq -r .pull_request.title "$GITHUB_EVENT_PATH") - pr_url=$(jq -r .pull_request.html_url "$GITHUB_EVENT_PATH") - branch_name=$(jq -r .pull_request.head.ref "$GITHUB_EVENT_PATH") - target_branch=$(jq -r .pull_request.base.ref "$GITHUB_EVENT_PATH") - pr_number=$(jq -r .pull_request.number "$GITHUB_EVENT_PATH") - pr_body=$(jq -r .pull_request.body "$GITHUB_EVENT_PATH") - - initial_message_response=$(curl -s -X POST -H "Authorization: Bearer $SLACK_BOT_TOKEN" -H 'Content-type: application/json' --data "{ - \"channel\": \"$SLACK_CHANNEL\", - \"text\": \"New release pull request created: <$pr_url|$pr_title>\nBranch: $branch_name -> $target_branch\" - }" https://slack.com/api/chat.postMessage) - echo "Initial message response: $initial_message_response" - if echo "$initial_message_response" | jq -e .ok > /dev/null; then - message_ts=$(echo "$initial_message_response" | jq -r .ts) - echo "Message TS: $message_ts" - new_pr_body="Slack message_ts: ${message_ts}\n\n${pr_body}" - new_pr_body=$(echo -e "$new_pr_body") - echo "New PR body: $new_pr_body" - - update_pr_response=$(curl -s -X PATCH -H "Authorization: token $GITHUB_TOKEN" -H "Content-Type: application/json" --data "$(jq -n --arg body "$new_pr_body" '{body: $body}')" "$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/pulls/$pr_number") - echo "Update PR response: $update_pr_response" - else - echo "Failed to retrieve message_ts" - exit 1 - fi - - - name: Fetch and send commit messages to Slack - env: - SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SLACK_CHANNEL: 'C05PW7HGP36' # Replace with your Slack channel ID - run: | - pr_number=$(jq -r .pull_request.number "$GITHUB_EVENT_PATH") - pr_body=$(curl -s -H "Authorization: token $GITHUB_TOKEN" "$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/pulls/$pr_number" | jq -r .body) - message_ts=$(echo "$pr_body" | grep -oP 'Slack message_ts: \K\S+') - echo "Retrieved message_ts: $message_ts" - if [ -z "$message_ts" ]; then - echo "Error: No message_ts found in pull request description." - exit 1 - fi - - declare -A github_to_slack_map=( - ["mduchev"]="@Mihail Duchev" - ["krzysztof-kolakowski"]="@Krzysztof Kołakowski" - ["opchaves"]="@Paulo Chaves" - ["ommiles"]="@O.M. Miles" - ["duckdum"]="@eduardo" - ["rminhoto"]="@Roberto" - ["pecabum"]="@Petar Petrov" - ["pmwthunkable"]="@Paul Medlock-Walton" - ["JanhaviDahihande"]="@janhavi" - ["kkrogmerio"]="@Adrian" - ["TingC"]="@Ting Chou" - ["andresmechali"]="@Andrés Mechali" - ["Comum"]="@Miguel Ribeiro" - ["weihuali0509"]="@Wei Li" - ) - - commits_url=$(jq -r .pull_request.commits_url "$GITHUB_EVENT_PATH") - repo_url=$(jq -r .repository.html_url "$GITHUB_EVENT_PATH") - commits=$(curl -s -H "Authorization: token $GITHUB_TOKEN" "$commits_url") - commit_messages="" - for row in $(echo "${commits}" | jq -r '.[] | @base64'); do - _jq() { - echo ${row} | base64 --decode | jq -r ${1} - } - commit_message=$(_jq '.commit.message') - commit_sha=$(_jq '.sha') - commit_author=$(_jq '.commit.author.name') - commit_url="$repo_url/commit/$commit_sha" - github_user=$(_jq '.author.login') - slack_user=${github_to_slack_map[$github_user]} - if [ -z "$slack_user" ]; then - slack_user=$commit_author - fi - commit_messages="$commit_messages- <$commit_url|$commit_message> by $slack_user\n" - done - if [ -z "$commit_messages" ]; then - commit_messages="No commits found." - fi - echo "Commit messages: $commit_messages" - curl -s -X POST -H "Authorization: Bearer $SLACK_BOT_TOKEN" -H 'Content-type: application/json' --data "{ - \"channel\": \"$SLACK_CHANNEL\", - \"text\": \"Commits in this pull request:\n$commit_messages\", - \"thread_ts\": \"$message_ts\" - }" https://slack.com/api/chat.postMessage diff --git a/.github/workflows/release-notification-pr-synchronize.yml b/.github/workflows/release-notification-pr-synchronize.yml deleted file mode 100644 index e6bc75e..0000000 --- a/.github/workflows/release-notification-pr-synchronize.yml +++ /dev/null @@ -1,84 +0,0 @@ -name: Release Notification on PR Updated - -on: - pull_request: - types: [synchronize] - -jobs: - notify: - if: startsWith(github.event.pull_request.head.ref, 'release-') - runs-on: ubuntu-latest - steps: - - name: Install jq - run: sudo apt-get install -y jq - - - name: Fetch `thread_ts` from PR description - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - pr_number=$(jq -r .pull_request.number "$GITHUB_EVENT_PATH") - pr_body=$(curl -s -H "Authorization: token $GITHUB_TOKEN" "$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/pulls/$pr_number" | jq -r .body) - message_ts=$(echo "$pr_body" | grep -oP '^Slack message_ts: \K\S+') - echo "Retrieved message_ts: $message_ts" - echo "message_ts=$message_ts" >> $GITHUB_ENV - - - name: Fetch and send new commit message to Slack - env: - SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - message_ts: ${{ env.message_ts }} - SLACK_CHANNEL: 'C05PW7HGP36' # Replace with your Slack channel ID - run: | - declare -A github_to_slack_map=( - ["mduchev"]="@Mihail Duchev" - ["krzysztof-kolakowski"]="@Krzysztof Kołakowski" - ["opchaves"]="@Paulo Chaves" - ["ommiles"]="@O.M. Miles" - ["duckdum"]="@eduardo" - ["rminhoto"]="@Roberto" - ["pecabum"]="@Petar Petrov" - ["pmwthunkable"]="@Paul Medlock-Walton" - ["JanhaviDahihande"]="@janhavi" - ["kkrogmerio"]="@Adrian" - ["TingC"]="@Ting Chou" - ["andresmechali"]="@Andrés Mechali" - ["Comum"]="@Miguel Ribeiro" - ["weihuali0509"]="@Wei Li" - ) - - commits_url=$(jq -r .pull_request.commits_url "$GITHUB_EVENT_PATH") - repo_url=$(jq -r .repository.html_url "$GITHUB_EVENT_PATH") - latest_commit=$(curl -s -H "Authorization: token $GITHUB_TOKEN" $commits_url | jq -r '.[-1] | @base64') - - if [ -z "$latest_commit" ]; then - echo "No new commit found." - exit 0 - fi - - _jq() { - echo ${latest_commit} | base64 --decode | jq -r ${1} - } - commit_message=$(_jq '.commit.message') - commit_sha=$(_jq '.sha') - commit_author=$(_jq '.commit.author.name') - commit_url="$repo_url/commit/$commit_sha" - github_user=$(_jq '.author.login') - slack_user=${github_to_slack_map[$github_user]} - if [ -z "$slack_user" ]; then - slack_user=$commit_author - fi - commit_message_formatted="<$commit_url|$commit_message> by $slack_user" - - if [ -z "$commit_message_formatted" ]; then - commit_message_formatted="No new commits found." - fi - echo "Commit message: $commit_message_formatted" - - payload=$(jq -n --arg channel "$SLACK_CHANNEL" --arg text "New commit added: $commit_message_formatted" --arg thread_ts "$message_ts" '{ - channel: $channel, - text: $text, - thread_ts: $thread_ts - }') - echo "Payload: $payload" - curl -s -X POST -H "Authorization: Bearer $SLACK_BOT_TOKEN" -H 'Content-type: application/json' --data "$payload" https://slack.com/api/chat.postMessage - \ No newline at end of file diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml deleted file mode 100644 index bb1853e..0000000 --- a/.github/workflows/sync.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Sync - -on: - push: - branches: - - main -## main test -jobs: - sync-branches: - runs-on: ubuntu-latest - name: Syncing branches - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Create sync pull request - uses: duckdum/sync-branches-gh@v1.8.0 - with: - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - FROM_BRANCH: "main" - TO_BRANCH: "develop" - PULL_REQUEST_BODY: "This is an automatic Pull Request to keep develop up to date with main." - CONTENT_COMPARISON: true - REVIEWERS: '["duckdum"]' - \ No newline at end of file From 63e767fe0ae283b4f93fd5651f07d3086c04fe4e Mon Sep 17 00:00:00 2001 From: Eduardo Date: Mon, 3 Jun 2024 13:28:40 +0100 Subject: [PATCH 07/16] change (#83) --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 82e98bb..d914956 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,7 +10,7 @@ jobs: steps: - name: Send Slack notification - uses: duckdum/slack-release-notifications@v1.0.3 + uses: thunkable/slack-release-notifications@v1.0.3 with: slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }} slack-channel: 'C05PW7HGP36' From b436c8652c7bba6735e573277966c9188e472fbd Mon Sep 17 00:00:00 2001 From: Eduardo Date: Fri, 7 Jun 2024 14:16:33 +0100 Subject: [PATCH 08/16] Update thunkable/release-notifications action (#86) --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d914956..d44afca 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,7 +10,7 @@ jobs: steps: - name: Send Slack notification - uses: thunkable/slack-release-notifications@v1.0.3 + uses: thunkable/slack-release-notifications@v1.0.5 with: slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }} slack-channel: 'C05PW7HGP36' From e0cab755bf5117875a4564c7a56df8f2ce131af8 Mon Sep 17 00:00:00 2001 From: Eduardo Date: Fri, 26 Jul 2024 10:43:49 +0100 Subject: [PATCH 09/16] Change readme (#87) --- .github/workflows/main.yml | 20 +++++++++++++++++++- README.md | 5 ++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d44afca..64950a9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,4 +14,22 @@ jobs: with: slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }} slack-channel: 'C05PW7HGP36' - github-token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + github-token: ${{ secrets.GITHUB_TOKEN }} + initial-message-template: ':traffic_light: <${prUrl}|${prTitle}>' + github-to-slack-map: | + { + "mduchev": "U04K5DCNF18", + "krzysztof-kolakowski": "U03HMV3T2GH", + "opchaves": "U051MKEPJ8Y", + "ommiles": "U02CR4R48JX", + "duckdum": "U0449VAH4BY", + "rminhoto": "U05CT8P804T", + "pecabum": "U0461TZ2A2V", + "pmwthunkable": "U9JSLNYLT", + "JanhaviDahihande": "UJVRSE8D7", + "josmas": "URKH7GXM2", + "TingC": "U6EMD2ZG9", + "andresmechali": "U05QQEPP849", + "Comum": "U04LY9803C1", + "weihuali0509": "U1BCM5ZU4" + } \ No newline at end of file diff --git a/README.md b/README.md index d37cd52..6b34ac7 100644 --- a/README.md +++ b/README.md @@ -1 +1,4 @@ -# testcoverage \ No newline at end of file +# testcoverage + +Random text +1 \ No newline at end of file From d336b051dd51da8085e0e981c3aef106a11bbe8a Mon Sep 17 00:00:00 2001 From: Eduardo Date: Mon, 19 Aug 2024 20:48:01 +0000 Subject: [PATCH 10/16] add release action --- .github/workflows/release.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..a1f1164 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,19 @@ +name: Comment on Released PRs + +on: + release: + types: [published] + +jobs: + comment-released-prs: + if: github.event.release.prerelease == false + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Comment on PRs + uses: rdlf0/comment-released-prs-action@v1 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + comment-body: "🎉 Hooray! 🎊 This is now part of [{{name}}]({{html_url}}) ✨" From 8a96fea8264bef142bc651e88364737566cb7510 Mon Sep 17 00:00:00 2001 From: Eduardo Date: Mon, 19 Aug 2024 20:50:06 +0000 Subject: [PATCH 11/16] small change --- .github/workflows/release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a1f1164..07d2d2a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,7 +6,6 @@ on: jobs: comment-released-prs: - if: github.event.release.prerelease == false runs-on: ubuntu-latest steps: - name: Checkout repository From 1a8463dd4bb10898afbb81128aac4b2eef080092 Mon Sep 17 00:00:00 2001 From: Eduardo Date: Mon, 19 Aug 2024 20:52:03 +0000 Subject: [PATCH 12/16] another change --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 07d2d2a..642c6b5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,5 +14,5 @@ jobs: - name: Comment on PRs uses: rdlf0/comment-released-prs-action@v1 with: - github-token: ${{ secrets.GITHUB_TOKEN }} + repo-token: ${{ secrets.GITHUB_TOKEN }} comment-body: "🎉 Hooray! 🎊 This is now part of [{{name}}]({{html_url}}) ✨" From a910409c8591a7ba2ad2c604190cc5652b649fb1 Mon Sep 17 00:00:00 2001 From: Eduardo Date: Mon, 19 Aug 2024 21:55:58 +0100 Subject: [PATCH 13/16] try (#110) --- .github/workflows/release.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 642c6b5..22fac16 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,7 +12,8 @@ jobs: uses: actions/checkout@v4 - name: Comment on PRs - uses: rdlf0/comment-released-prs-action@v1 + uses: apexskier/github-release-commenter@v1 with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - comment-body: "🎉 Hooray! 🎊 This is now part of [{{name}}]({{html_url}}) ✨" + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + comment-template: | + Release {release_link} addresses this. From 8b087061b112ea2a8aa7dadfd22776b74867e02a Mon Sep 17 00:00:00 2001 From: Eduardo Date: Mon, 19 Aug 2024 22:01:37 +0100 Subject: [PATCH 14/16] try 3 (#112) --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 22fac16..8cca5cf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,6 +13,7 @@ jobs: - name: Comment on PRs uses: apexskier/github-release-commenter@v1 + if: github.event.release.prerelease == false with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} comment-template: | From 078fb5e972d38e17169a24b96e31514f73969dc8 Mon Sep 17 00:00:00 2001 From: Eduardo Date: Mon, 19 Aug 2024 22:06:37 +0100 Subject: [PATCH 15/16] change test (#113) --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8cca5cf..2c73486 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,4 +17,4 @@ jobs: with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} comment-template: | - Release {release_link} addresses this. + 🎉 Hooray! 🎊 This is now part of [{{name}}]({{html_url}}) ✨ From f41886c4d1306c4d88bdf3beb3edd43c93b848c4 Mon Sep 17 00:00:00 2001 From: Eduardo Date: Mon, 19 Aug 2024 22:21:49 +0100 Subject: [PATCH 16/16] new release finish (#114) --- .github/workflows/release.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2c73486..24474f1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,4 +17,12 @@ jobs: with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} comment-template: | - 🎉 Hooray! 🎊 This is now part of [{{name}}]({{html_url}}) ✨ + :tada: This is included in version {release_link} :tada: + + The release is available on: + + * [GitHub releases](https://github.com/duckdum/testcoverage/releases/tag/{release_tag}) + + Cheers! 📦🚀 + label-template: ":rocket: released,release-{release_tag}" +