File tree 1 file changed +29
-6
lines changed
1 file changed +29
-6
lines changed Original file line number Diff line number Diff line change @@ -24,14 +24,37 @@ jobs:
24
24
pip install requests beautifulsoup4
25
25
26
26
- name : Run update_readme.py
27
+ id : update_readme
27
28
run : python update_readme.py
28
29
29
30
- name : Create GitHub issue on failure
30
31
if : failure()
31
- uses : peter-evans/create-issue-from-file@v2
32
+ uses : actions/github-script@v6
32
33
with :
33
- title : " Update README with LeetCode Daily Challenge Failed"
34
- content : |
35
- The GitHub Action to update README with LeetCode Daily Challenge has failed.
36
- Please check the workflow logs for more details.
37
- labels : bug
34
+ github-token : ${{ secrets.GITHUB_TOKEN }}
35
+ script : |
36
+ const issueTitle = "Update README with LeetCode Daily Challenge Failed";
37
+ const issueBody = `
38
+ The GitHub Action to update README with LeetCode Daily Challenge has failed.
39
+ Please check the workflow logs for more details.
40
+ `;
41
+
42
+ const { data: existingIssues } = await github.issues.listForRepo({
43
+ owner: context.repo.owner,
44
+ repo: context.repo.repo,
45
+ state: 'open',
46
+ labels: 'bug',
47
+ title: issueTitle,
48
+ });
49
+
50
+ if (existingIssues.length === 0) {
51
+ await github.issues.create({
52
+ owner: context.repo.owner,
53
+ repo: context.repo.repo,
54
+ title: issueTitle,
55
+ body: issueBody,
56
+ labels: ['bug'],
57
+ });
58
+ } else {
59
+ console.log(`An issue with the title "${issueTitle}" already exists.`);
60
+ }
You can’t perform that action at this time.
0 commit comments