Skip to content

Commit

Permalink
Merge pull request #302 from creative-commoners/pulls/master/broken-b…
Browse files Browse the repository at this point in the history
…uild-card

ENH Look for an existing rhino issue before creating a new one
  • Loading branch information
GuySartorelli authored Aug 28, 2024
2 parents a1a7588 + 55db8c1 commit 4c535b9
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/rhino-issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,32 @@ jobs:
permissions:
issues: write
steps:
- name: Check for existing open issue
id: check_for_existing_open_issue
run: |
# get the date 21 days ago to limit issues returned to allow a broken builds issue to
# be unresolved for up to 3 weeks
SINCE=$(date -d "-21 days" '+%Y-%m-%d')
# https://docs.github.com/en/rest/issues/issues?apiVersion=2022-11-28#list-repository-issues
RESP_CODE=$(curl -w %{http_code} -s -L -o __response.json \
-X GET \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ github.token }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/$GITHUB_REPOSITORY/issues?state=open\&since=$SINCE
)
# use jq to find github issues with the title "Broken builds and merge-ups"
ISSUE_NUMBER=$(jq -r '.[] | select(.title == "Broken builds and merge-ups") | .id' __response.json)
if [[ "$ISSUE_NUMBER" == "" ]]; then
echo "Did not find an open issue with the title 'Broken builds and merge-ups'"
echo "has_issue=false" >> $GITHUB_OUTPUT
else
echo "Found an open issue with the title 'Broken builds and merge-ups'"
echo "has_issue=true" >> $GITHUB_OUTPUT
fi
- name: Rhino issue
uses: silverstripe/gha-issue@v1
if: steps.check_for_existing_open_issue.outputs.has_issue == 'false'
with:
title: Broken builds and merge-ups
close_existing: true
Expand Down

0 comments on commit 4c535b9

Please sign in to comment.