Skip to content

Commit

Permalink
Do not create a new issue on cargo-generate merge conflicts if one …
Browse files Browse the repository at this point in the history
…already exists (#277)

Closes #276.

This uses `gh` to query for open issues, counts them, then exits early
if any exist.

---------

Co-authored-by: Ben Frankel <[email protected]>
  • Loading branch information
BD103 and benfrankel committed Aug 16, 2024
1 parent 5065d6b commit 62840b5
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/cargo-generate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,20 @@ jobs:
# This is required to use the `gh` CLI.
GH_TOKEN: ${{ github.token }}
run: |
# Get a list of the IDs of open issues created by this action, then count them using JQ.
OPEN_ISSUES="$(
gh issue list \
--search "is:issue is:open author:app/github-actions in:title ${TITLE}" \
--json id \
--jq '. | length'
)"
# If an issue already exists, do not create another.
if [[ "${OPEN_ISSUES}" -gt 0 ]]; then
echo 'An issue already exists on merge conflicts! Exiting without creating another.'
exit 0
fi
GIT_STATUS="$(git status)"
# Filter the diff to only include files with merge conflicts.
Expand Down

0 comments on commit 62840b5

Please sign in to comment.