Skip to content
73 changes: 25 additions & 48 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,58 +1,35 @@
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: thunkable/slack-release-notifications@v1.0.5
with:
barecheck-github-app-token: ${{ secrets.BARECHECK_GITHUB_APP_TOKEN }}
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
slack-channel: 'C05PW7HGP36'
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"
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"
}
105 changes: 0 additions & 105 deletions .github/workflows/release-notification-pr-opened.yml

This file was deleted.

73 changes: 0 additions & 73 deletions .github/workflows/release-notification-pr-synchronize.yml

This file was deleted.

28 changes: 28 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Comment on Released PRs

on:
release:
types: [published]

jobs:
comment-released-prs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Comment on PRs
uses: apexskier/github-release-commenter@v1
if: github.event.release.prerelease == false
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
comment-template: |
: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}"

24 changes: 0 additions & 24 deletions .github/workflows/sync.yml

This file was deleted.

5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# testcoverage
# testcoverage

Random text
1
5 changes: 4 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 };