From 386072318ff2b0aa9fa70a0e4438d68da0f501e5 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Fri, 7 Apr 2023 20:46:47 +0200 Subject: [PATCH] chore: filter known contributions --- .github/workflows/contributors.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/contributors.yml b/.github/workflows/contributors.yml index e9fffe1a..2012c9db 100644 --- a/.github/workflows/contributors.yml +++ b/.github/workflows/contributors.yml @@ -16,6 +16,7 @@ jobs: with: github-token: ${{ secrets.GH_PAT }} script: | + const fs = require('fs'); const { repo: { owner, repo } } = context; const pr = context.payload.pull_request; @@ -52,7 +53,20 @@ jobs: } if (contributions.length === 0) { - console.log('No relevant additions found'); + console.log('No relevant contributions found'); + return; + } + + var data = fs.readFileSync('.all-contributorsrc', 'utf8'); + let json = JSON.parse(data); + const contributor = json.contributors.find(contributor => contributor.login === pr.user.login); + if (contributor) { + console.log(contributor); + contributions = contributions.filter(contribution => !contributor.contributions.includes(contribution)); + } + + if (contributions.length === 0) { + console.log('No new contributions found'); return; }