Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH Look for an existing rhino issue before creating a new one #302

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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')
Comment on lines +23 to +25
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good idea.

# 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