Skip to content

Commit e099379

Browse files
authored
Merge pull request #92 from Seasawher/develop
test: avoid creating duplicate issues
2 parents 37aadab + 0a40e5c commit e099379

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ What to do when an update is available and the build is successful.
117117
Allowed values:
118118
* `silent`: Do nothing
119119
* `commit`: directly commit the updated files
120-
* `issue`: notify the user by creating an issue
121-
* `pr`: notify the user by creating a pull request
120+
* `issue`: notify the user by creating an issue. No new issue will be created if one already exists.
121+
* `pr`: notify the user by creating a pull request. No new PR will be created if one already exists.
122122

123123
Default: `pr`.
124124

@@ -128,8 +128,8 @@ What to do when an update is available and the build fails.
128128

129129
Allowed values:
130130
* `silent`: Do nothing
131-
* `issue`: notify the user by creating an issue
132-
* `pr`: notify the user by creating a pull request
131+
* `issue`: notify the user by creating an issue. No new issue will be created if one already exists.
132+
* `pr`: notify the user by creating a pull request. No new PR will be created if one already exists.
133133

134134
Default: `issue`.
135135

action.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ inputs:
88
Allowed values:
99
* `silent`: Do nothing
1010
* `commit`: directly commit the updated files
11-
* `issue`: notify the user by creating an issue
12-
* `pr`: notify the user by creating a pull request
11+
* `issue`: notify the user by creating an issue. No new issue will be created if one already exists.
12+
* `pr`: notify the user by creating a pull request. No new PR will be created if one already exists.
1313
Default: `pr`.
1414
required: false
1515
default: "pr"
@@ -18,8 +18,8 @@ inputs:
1818
What to do when an update is available and the build fails.
1919
Allowed values:
2020
* `silent`: Do nothing
21-
* `issue`: notify the user by creating an issue
22-
* `pr`: notify the user by creating a pull request
21+
* `issue`: notify the user by creating an issue. No new issue will be created if one already exists.
22+
* `pr`: notify the user by creating a pull request. No new PR will be created if one already exists.
2323
Default: `issue`.
2424
required: false
2525
default: "issue"

scripts/create-issue.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,10 @@ if ! gh api repos/$GH_REPO/labels/$LABEL_NAME --silent 2>/dev/null; then
1818
gh api repos/$GH_REPO/labels -F name="$LABEL_NAME" -F color="$LABEL_COLOR" -F description="Auto update for Lean dependencies"
1919
fi
2020

21-
# Create the issue
22-
gh issue create --title "$TITLE" --body "$BODY" --label "$LABEL_NAME"
21+
# Check if an open issue with the same label already exists
22+
if gh issue list --label "$LABEL_NAME" --state open --json number | grep -q "number"; then
23+
echo "An open issue with label '$LABEL_NAME' already exists. Skipping issue creation."
24+
else
25+
# Create the issue
26+
gh issue create --title "$TITLE" --body "$BODY" --label "$LABEL_NAME"
27+
fi

0 commit comments

Comments
 (0)