File tree Expand file tree Collapse file tree 1 file changed +29
-6
lines changed Expand file tree Collapse file tree 1 file changed +29
-6
lines changed Original file line number Diff line number Diff line change @@ -24,14 +24,37 @@ jobs:
2424 pip install requests beautifulsoup4
2525
2626 - name : Run update_readme.py
27+ id : update_readme
2728 run : python update_readme.py
2829
2930 - name : Create GitHub issue on failure
3031 if : failure()
31- uses : peter-evans/create-issue-from-file@v2
32+ uses : actions/github-script@v6
3233 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