From d392d2dbb33979bfea7ebe0a2bc7e2b8082c1601 Mon Sep 17 00:00:00 2001 From: Ben Lambert Date: Thu, 20 Jan 2022 13:02:59 +0100 Subject: [PATCH 1/8] change run frequency to push Signed-off-by: Ben Lambert --- .github/workflows/goalie.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/goalie.yaml b/.github/workflows/goalie.yaml index 93ca4209fc..e5e5d39762 100644 --- a/.github/workflows/goalie.yaml +++ b/.github/workflows/goalie.yaml @@ -1,8 +1,9 @@ # on a review from someone in the reviewers group, remove the awaiting-review label and add the awaiting-author label name: 'goalie: run cron' -on: - schedule: - - cron: '* * * * *' +#on: +# schedule: +# - cron: '* * * * *' +on: push jobs: label: From 1e423fab53cab694281fcad96bd61930d599e8fc Mon Sep 17 00:00:00 2001 From: Ben Lambert Date: Thu, 20 Jan 2022 13:05:58 +0100 Subject: [PATCH 2/8] chore: add a check to see what's going on with an event Signed-off-by: Ben Lambert --- scripts/goalie-labels.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/goalie-labels.js b/scripts/goalie-labels.js index e0e0b17051..7178330e5c 100644 --- a/scripts/goalie-labels.js +++ b/scripts/goalie-labels.js @@ -69,7 +69,14 @@ const getRepoEvents = async ({ github, context, pull_number }) => { return events .sort((a, b) => new Date(a.updated_at) - new Date(b.updated_at)) - .filter(({ user }) => !user.login.includes('[bot]')); + .filter(({ user, ...evt }) => { + if (!user) { + console.warn('no evt', evt); + return false + } + + return !user.login.includes('[bot]'); + }); }; module.exports = async ({ github, context, core }) => { From 6d08f818a6172f90bb4932bde7d76d5842a99685 Mon Sep 17 00:00:00 2001 From: Ben Lambert Date: Thu, 20 Jan 2022 13:19:17 +0100 Subject: [PATCH 3/8] Fixing by falling back to the committer and check to see if there's a user Signed-off-by: Ben Lambert --- scripts/goalie-labels.js | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/scripts/goalie-labels.js b/scripts/goalie-labels.js index 7178330e5c..b706eba7fb 100644 --- a/scripts/goalie-labels.js +++ b/scripts/goalie-labels.js @@ -50,9 +50,9 @@ const getRepoEvents = async ({ github, context, pull_number }) => { updated_at: submitted_at, type: 'review', })), - ...commits.map(({ commit, author }) => ({ - user: author, - updated_at: commit.author.date, + ...commits.map(({ commit, author, committer }) => ({ + user: author ?? committer, + updated_at: commit.author.date ?? commit.committer.date, type: 'commit', })), ...pullComments.map(({ user, updated_at }) => ({ @@ -69,14 +69,7 @@ const getRepoEvents = async ({ github, context, pull_number }) => { return events .sort((a, b) => new Date(a.updated_at) - new Date(b.updated_at)) - .filter(({ user, ...evt }) => { - if (!user) { - console.warn('no evt', evt); - return false - } - - return !user.login.includes('[bot]'); - }); + .filter(({ user, ...evt }) => !user?.login.includes('[bot]') ?? false); }; module.exports = async ({ github, context, core }) => { From e053eb597a120e4da793a71e86dc7d115436ab5b Mon Sep 17 00:00:00 2001 From: Ben Lambert Date: Thu, 20 Jan 2022 13:21:47 +0100 Subject: [PATCH 4/8] Replace to pipes instead Signed-off-by: Ben Lambert --- scripts/goalie-labels.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/goalie-labels.js b/scripts/goalie-labels.js index b706eba7fb..2534cd0c34 100644 --- a/scripts/goalie-labels.js +++ b/scripts/goalie-labels.js @@ -51,8 +51,8 @@ const getRepoEvents = async ({ github, context, pull_number }) => { type: 'review', })), ...commits.map(({ commit, author, committer }) => ({ - user: author ?? committer, - updated_at: commit.author.date ?? commit.committer.date, + user: author || committer, + updated_at: commit.author.date || commit.committer.date, type: 'commit', })), ...pullComments.map(({ user, updated_at }) => ({ From aad66df1ba5a86579eae3f4d269fdd745612f8e9 Mon Sep 17 00:00:00 2001 From: Ben Lambert Date: Thu, 20 Jan 2022 13:25:22 +0100 Subject: [PATCH 5/8] Doesn't support optional chaining Signed-off-by: Ben Lambert --- scripts/goalie-labels.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/goalie-labels.js b/scripts/goalie-labels.js index 2534cd0c34..10e6c59465 100644 --- a/scripts/goalie-labels.js +++ b/scripts/goalie-labels.js @@ -69,7 +69,7 @@ const getRepoEvents = async ({ github, context, pull_number }) => { return events .sort((a, b) => new Date(a.updated_at) - new Date(b.updated_at)) - .filter(({ user, ...evt }) => !user?.login.includes('[bot]') ?? false); + .filter(({ user, ...evt }) => user ? !user.login.includes('[bot]') : false); }; module.exports = async ({ github, context, core }) => { From b9e5973d9bd86a379246b15de6a83c0b799b9256 Mon Sep 17 00:00:00 2001 From: Ben Lambert Date: Thu, 20 Jan 2022 13:27:14 +0100 Subject: [PATCH 6/8] Removing unused var Signed-off-by: Ben Lambert --- scripts/goalie-labels.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/goalie-labels.js b/scripts/goalie-labels.js index 10e6c59465..f1377516a6 100644 --- a/scripts/goalie-labels.js +++ b/scripts/goalie-labels.js @@ -69,7 +69,7 @@ const getRepoEvents = async ({ github, context, pull_number }) => { return events .sort((a, b) => new Date(a.updated_at) - new Date(b.updated_at)) - .filter(({ user, ...evt }) => user ? !user.login.includes('[bot]') : false); + .filter(({ user }) => user ? !user.login.includes('[bot]') : false); }; module.exports = async ({ github, context, core }) => { From e872c7ebaf59fb14cdaceeabd75506b7bfbe52c2 Mon Sep 17 00:00:00 2001 From: Ben Lambert Date: Thu, 20 Jan 2022 13:30:24 +0100 Subject: [PATCH 7/8] Revert back to cron Signed-off-by: Ben Lambert --- .github/workflows/goalie.yaml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/goalie.yaml b/.github/workflows/goalie.yaml index e5e5d39762..a71dee375c 100644 --- a/.github/workflows/goalie.yaml +++ b/.github/workflows/goalie.yaml @@ -1,10 +1,9 @@ # on a review from someone in the reviewers group, remove the awaiting-review label and add the awaiting-author label name: 'goalie: run cron' -#on: -# schedule: -# - cron: '* * * * *' -on: push - +on: + schedule: + - cron: '* * * * *' + jobs: label: runs-on: ubuntu-latest From 21885379c17bbce1162d95a9129358dae3b95904 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Thu, 20 Jan 2022 14:06:43 +0100 Subject: [PATCH 8/8] fixup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- .github/workflows/goalie.yaml | 2 +- scripts/goalie-labels.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/goalie.yaml b/.github/workflows/goalie.yaml index a71dee375c..93ca4209fc 100644 --- a/.github/workflows/goalie.yaml +++ b/.github/workflows/goalie.yaml @@ -3,7 +3,7 @@ name: 'goalie: run cron' on: schedule: - cron: '* * * * *' - + jobs: label: runs-on: ubuntu-latest diff --git a/scripts/goalie-labels.js b/scripts/goalie-labels.js index f1377516a6..e0a5b966d0 100644 --- a/scripts/goalie-labels.js +++ b/scripts/goalie-labels.js @@ -69,7 +69,7 @@ const getRepoEvents = async ({ github, context, pull_number }) => { return events .sort((a, b) => new Date(a.updated_at) - new Date(b.updated_at)) - .filter(({ user }) => user ? !user.login.includes('[bot]') : false); + .filter(({ user }) => (user ? !user.login.includes('[bot]') : false)); }; module.exports = async ({ github, context, core }) => {