From cbbeb1bb5f87845a34d53daf2de26d925257985f Mon Sep 17 00:00:00 2001 From: make-github-pseudonymous-again <5165674+make-github-pseudonymous-again@users.noreply.github.com> Date: Sun, 4 Feb 2024 17:34:31 +0100 Subject: [PATCH] :boom: feat!: GitHub mark-as-read now defaults to a disjunction of filters. BREAKING CHANGE: Default was conjunction. --- .bin/github.mark_as_read.daemon | 18 ++++++++---------- .../systemd/user/github.mark_as_read.service | 2 +- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/.bin/github.mark_as_read.daemon b/.bin/github.mark_as_read.daemon index 2b22fbad..3fadbbb4 100755 --- a/.bin/github.mark_as_read.daemon +++ b/.bin/github.mark_as_read.daemon @@ -65,17 +65,15 @@ while read -r line ; do for filter in "${!filters[@]}"; do passes "$pr" "$filter" "$updated_at" rc="$?" - if [ "$rc" -ne 0 ] ; then - if [ "$rc" -eq 1 ] ; then - # shellcheck disable=SC2016 - >&2 printf 'Not marking #%s as read: %s (%s) because it does not satisfy filter `%s`\n' "$id" "$title" "$pr" "$filter" - else - >&2 printf 'Not marking #%s as read: %s (%s) because of API error\n' "$id" "$title" "$pr" - fi + if [ "$rc" -eq 0 ] ; then + >&2 printf 'Marking thread #%s as read: %s (%s)\n' "$id" "$title" "$pr" + github.mark_as_read "$id" continue 2 + elif [ "$rc" -eq 1 ] ; then + # shellcheck disable=SC2016 + >&2 printf 'Not marking #%s as read: %s (%s) because it does not satisfy filter `%s`\n' "$id" "$title" "$pr" "$filter" + else + >&2 printf 'Not marking #%s as read: %s (%s) because of API error\n' "$id" "$title" "$pr" fi done - - >&2 printf 'Marking thread #%s as read: %s (%s)\n' "$id" "$title" "$pr" - github.mark_as_read "$id" done diff --git a/.config/systemd/user/github.mark_as_read.service b/.config/systemd/user/github.mark_as_read.service index 540649e5..79bdd856 100644 --- a/.config/systemd/user/github.mark_as_read.service +++ b/.config/systemd/user/github.mark_as_read.service @@ -5,4 +5,4 @@ Description=Github mark notifications read service Type=simple Restart=on-failure RestartSec=300 -ExecStart=/usr/bin/env github.mark_as_read.daemon '.user.login == "renovate[bot]"' '.state == "closed"' +ExecStart=/usr/bin/env github.mark_as_read.daemon '.user.login == "renovate[bot]" and .state == "closed"' '.title == ":arrow_up: deps: Upgrade codecov/codecov-action action to v4"'