Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

404 when attempting to access topics for a repo #51

Closed
tchupp opened this issue Jul 21, 2023 · 3 comments · Fixed by #56
Closed

404 when attempting to access topics for a repo #51

tchupp opened this issue Jul 21, 2023 · 3 comments · Fixed by #56
Labels
bug Something isn't working

Comments

@tchupp
Copy link

tchupp commented Jul 21, 2023

Bug Report

404 when attempting to access topics for repo.

The action is able to access a number of repos, but fails out when it is unable to get topics from an unknown repo.

I don't believe this is a permissions issue, since it is able to get the age of many other repos before it fails.
Many of the repos that it was able fetch the age of have an empty topics list.

Configuration

name: stale repo identifier

on:
  workflow_dispatch:
  schedule:
    - cron: '3 2 1 * *'

jobs:
  build:
    name: stale repo identifier
    runs-on: ubuntu-latest

    steps:
    - name: Run stale_repos tool
      uses: github/stale-repos@v1
      env:
        GH_TOKEN: ${{ secrets.ORG_REPOS_GITHUB_TOKEN }}
        ORGANIZATION: "<org>"
        EXEMPT_TOPICS: "keep,template"
        INACTIVE_DAYS: 180

    - name: Create issue
      uses: peter-evans/create-issue-from-file@v4
      with:
        title: Stale repository report
        content-filepath: ./stale_repos.md
        token: ${{ secrets.GITHUB_TOKEN }}

Issue

Output

/usr/bin/docker run --name ghcriogithubstale_reposv1_5ffdb8 --label c9a4a5 --workdir /github/workspace --rm -e "GH_TOKEN" -e "ORGANIZATION" -e "EXEMPT_TOPICS" -e "INACTIVE_DAYS" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_REPOSITORY_OWNER_ID" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_REPOSITORY_ID" -e "GITHUB_ACTOR_ID" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKFLOW_REF" -e "GITHUB_WORKFLOW_SHA" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_ENVIRONMENT" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/.github/.github":"/github/workspace" ghcr.io/github/stale_repos:v1
Starting stale repo search...
Exempt topics: ['keep', 'template']
https://github.com/<org>/<omitted>: 2135 days inactive
https://github.com/<org>/<omitted>: 225 days inactive
https://github.com/<org>/<omitted>: 2495 days inactive
https://github.com/<org>/<omitted>: 1424 days inactive
https://github.com/<org>/<omitted>: 2446 days inactive
https://github.com/<org>/<omitted>: 2104 days inactive
https://github.com/<org>/<omitted>: 2339 days inactive
https://github.com/<org>/<omitted>: 1351 days inactive
https://github.com/<org>/<omitted>: 247 days inactive
https://github.com/<org>/<omitted>: 1446 days inactive
https://github.com/<org>/<omitted>: 2136 days inactive
https://github.com/<org>/<omitted>: 1610 days inactive
https://github.com/<org>/<omitted>: 247 days inactive
https://github.com/<org>/<omitted>: 247 days inactive
https://github.com/<org>/<omitted>: 247 days inactive
https://github.com/<org>/<omitted>: 1738 days inactive
https://github.com/<org>/<omitted>: 1658 days inactive
https://github.com/<org>/<omitted>: 2136 days inactive
https://github.com/<org>/<omitted>: 2136 days inactive
https://github.com/<org>/<omitted>: 2136 days inactive
https://github.com/<org>/<omitted>: 2123 days inactive
https://github.com/<org>/<omitted>: 2040 days inactive
https://github.com/<org>/<omitted>: 2104 days inactive
https://github.com/<org>/<omitted>: 247 days inactive
https://github.com/<org>/<omitted>: 247 days inactive
https://github.com/<org>/<omitted>: 1907 days inactive
https://github.com/<org>/<omitted>: 247 days inactive
https://github.com/<org>/<omitted>: 247 days inactive
https://github.com/<org>/<omitted>: 1928 days inactive
https://github.com/<org>/<omitted>: 247 days inactive
https://github.com/<org>/<omitted>: 247 days inactive
https://github.com/<org>/<omitted>: 247 days inactive
https://github.com/<org>/<omitted>: 247 days inactive
https://github.com/<org>/<omitted>: 247 days inactive
https://github.com/<org>/<omitted>: 1219 days inactive
https://github.com/<org>/<omitted>: 193 days inactive
https://github.com/<org>/<omitted>: 1768 days inactive
https://github.com/<org>/<omitted>: 1696 days inactive
https://github.com/<org>/<omitted>: 247 days inactive
https://github.com/<org>/<omitted>: 1708 days inactive
https://github.com/<org>/<omitted>: 247 days inactive
https://github.com/<org>/<omitted>: 1282 days inactive
https://github.com/<org>/<omitted>: 247 days inactive
https://github.com/<org>/<omitted>: 247 days inactive
https://github.com/<org>/<omitted>: 1348 days inactive
https://github.com/<org>/<omitted>: 1562 days inactive
https://github.com/<org>/<omitted>: 247 days inactive
https://github.com/<org>/<omitted>: 195 days inactive
https://github.com/<org>/<omitted>: 247 days inactive
https://github.com/<org>/<omitted>: 247 days inactive
https://github.com/<org>/<omitted>: 247 days inactive
https://github.com/<org>/<omitted>: 441 days inactive
https://github.com/<org>/<omitted>: 247 days inactive
https://github.com/<org>/<omitted>: 247 days inactive
https://github.com/<org>/<omitted>: 247 days inactive
https://github.com/<org>/<omitted>: 247 days inactive
https://github.com/<org>/<omitted>: 247 days inactive
https://github.com/<org>/<omitted>: 1342 days inactive
https://github.com/<org>/<omitted>: 233 days inactive
https://github.com/<org>/<omitted>: 247 days inactive
https://github.com/<org>/<omitted>: 247 days inactive
https://github.com/<org>/<omitted>: 247 days inactive
https://github.com/<org>/<omitted>: 247 days inactive
https://github.com/<org>/<omitted>: 247 days inactive
https://github.com/<org>/<omitted>: 247 days inactive
https://github.com/<org>/<omitted>: 597 days inactive
https://github.com/<org>/<omitted>: 182 days inactive
https://github.com/<org>/<omitted>: 190 days inactive
https://github.com/<org>/<omitted>: 247 days inactive
https://github.com/<org>/<omitted>: 1127 days inactive
https://github.com/<org>/<omitted>: 248 days inactive
https://github.com/<org>/<omitted>: 444 days inactive
https://github.com/<org>/<omitted>: 247 days inactive

Traceback (most recent call last):
  File "/action/workspace/stale_repos.py", line 196, in <module>
    main()
  File "/action/workspace/stale_repos.py", line 52, in main
    inactive_repos = get_inactive_repos(
                     ^^^^^^^^^^^^^^^^^^^
  File "/action/workspace/stale_repos.py", line [88](https://github.com/<org>/.github/actions/runs/5626259153/job/15246705935#step:3:89), in get_inactive_repos
    topic in exempt_topics for topic in repo.topics().names
                                        ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/github3/repos/repo.py", line 2793, in topics
    json = self._json(self._get(url, headers=self.PREVIEW_HEADERS), 200)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/github3/models.py", line 161, in _json
    raise exceptions.error_for(response)
github3.exceptions.NotFoundError: 404 Not Found
@zkoppert zkoppert added the bug Something isn't working label Aug 3, 2023
@zkoppert
Copy link
Member

zkoppert commented Aug 3, 2023

Thanks for reporting this issue. I have tried to reproduce a few different ways with no luck. Have you been able to confirm that the token you used has read access to that repository or did that repo get deleted/archived?

@tchupp
Copy link
Author

tchupp commented Aug 15, 2023

I was able to track down the repo that was causing this issue!

I was confused on this one for a while! I ended up cloning the repo and adding some debug logging locally to figure it out.

Turns out it was a private "temporary fork" created by GitHub for a Security Advisory:
image

Regardless, it does break this action for my org consistently. It seems that private temporary forks don't have topics 🤷🏽
Unfortunately, it doesn't seem like we are able to clean up these private forks: https://github.com/orgs/community/discussions/23820

For now, I was able to add this specific repo to the EXEMPT_REPOS list 😁

@zkoppert
Copy link
Member

zkoppert commented Aug 15, 2023

Oh interesting! Thanks for reporting back!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants