Skip to content

Commit

Permalink
Merge pull request #586 from bellkev/ignore-all-issues
Browse files Browse the repository at this point in the history
Ignore references to old/unmaintained projects in closed issues
  • Loading branch information
svennam92 authored Oct 14, 2024
2 parents 370563e + e0f6d5a commit c974785
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/actions/linkbot/linkbot/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
gh = github.Client(conf.gh_token)
repo_root = pathlib.Path(conf.repo_root)
all_links = github_links_in_files(repo_root, conf.glob)
bot_messages = gh.get_open_issue_messages(conf.repo_url, conf.gh_user)
bot_messages = gh.get_all_issue_messages(conf.repo_url, conf.gh_user)
existing_links = github_links_in_strs(bot_messages)
for link in all_links:
try:
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/linkbot/linkbot/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ def get_repo_stats(self, url):
)


def get_open_issue_messages(self, repo_url, user):
def get_all_issue_messages(self, repo_url, user):
full_name = repo_full_name_from_url(repo_url)
repo = self._pygh.get_repo(full_name)
return [issue.body for issue in repo.get_issues(state='open', creator=user)]
return [issue.body for issue in repo.get_issues(state='all', creator=user)]


def create_issue(self, repo_url, title, body):
Expand Down
8 changes: 3 additions & 5 deletions .github/actions/linkbot/tests/test_github.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ def test_get_repo_stats():


@pytest.mark.network
def test_get_open_issue_messages():
def test_get_all_issue_messages():
gh = Client(os.environ.get('LINKBOT_GH_TOKEN'))
expected = 'java.lang.IllegalArgumentException'
messages = gh.get_open_issue_messages('https://github.com/bellkev/dacom', 'r00k')
assert len(messages) == 1
assert expected in messages[0]
messages = gh.get_all_issue_messages('https://github.com/bellkev/dacom', 'r00k')
assert len(messages) == 2

0 comments on commit c974785

Please sign in to comment.