From 9f7befe39cd81564a69f6b47980fd9d4654853fe Mon Sep 17 00:00:00 2001 From: Katrina Owen Date: Tue, 29 Nov 2022 08:48:45 +0100 Subject: [PATCH] Fail closed on pause contributions workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In the original workflow, I had `catch(err) => false`. But during code review the question was raised: What happens if we get rate limited and all the requests from the API fail? (E.g. if we do a script and automatically create PRs across all of Exercism, which is totally a thing). We were like: ooh, that would suck, wouldn’t it? It would be better if we occasionally had to deal with manually closing a PR. But here’s the kicker. The API response has no body. It’s either 204 or 404, where 404 is perceived as… an error. So I changed it, and (importantly) forgot to test the script one final time. So here is a version that will actually work. (I tested.) --- .github/workflows/pause-community-contributions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pause-community-contributions.yml b/.github/workflows/pause-community-contributions.yml index 85d18d1c..16b1ca55 100644 --- a/.github/workflows/pause-community-contributions.yml +++ b/.github/workflows/pause-community-contributions.yml @@ -30,7 +30,7 @@ jobs: org: context.repo.owner, username: context.actor, }).then(response => response.status == 204) - .catch(err => true); + .catch(err => false); - name: Comment if: steps.is-organization-member.outputs.result == 'false' uses: actions/github-script@d556feaca394842dc55e4734bf3bb9f685482fa0