Skip to content

feat: Add a weekly workflow to tag archived repos #3103

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

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

esafak
Copy link
Contributor

@esafak esafak commented Aug 11, 2025

This commit introduces a new GitHub Actions workflow that runs weekly to identify and tag archived repositories listed in packages.json.

What it does

  • Forge Compatibility: Queries repos on Github using the gh CLI's GraphQL API in batches of BATCH_SIZE. The GitHub-specific logic is applied to only GitHub URLs, preventing errors with other forges.
  • Deleted Packages: Packages that are not found on GitHub or are already tagged as 'deleted' are now moved to a new deleted_packages.json file, keeping the main packages.json clean.
  • Archived Packages: Repositories that are archived on GitHub are now explicitly tagged with 'archived' and remain in packages.json.
  • Robust URL Parsing: The script now uses urllib.parse to correctly handle GitHub URLs, stripping any query parameters or fragments.
  • Dynamic Commits: The workflow now generates a detailed commit message listing the packages that were moved or tagged, and only commits if there are changes.
  • Commits the changes to packages.json. Here is an example commit.

Closes #2075

google-labs-jules bot and others added 5 commits August 11, 2025 01:17
This commit introduces a new GitHub Actions workflow that runs weekly to identify and tag archived repositories listed in `packages.json`.

The workflow executes a Python script that:
- Parses `packages.json` to find GitHub repositories.
- Uses the `gh` CLI to query the GitHub GraphQL API in batches.
- Checks if repositories are archived.
- Adds the "deleted" tag to archived repositories.
- Commits the changes to `packages.json`.

The batch size for the GraphQL query is configurable via the `BATCH_SIZE` environment variable in the workflow file.
* Enhance the `run_gh_query` function to gracefully handle API errors and parse partial JSON responses.
* Refactor the main logic to identify both archived repositories and repositories that no longer exist.
* Update the `packages.json` to tag both archived and deleted repositories with a "deleted" tag.
* Provide more informative output messages for repository status changes.
This commit introduces a major overhaul of the weekly package checking workflow. The script and workflow have been updated to be more robust and to handle package states more gracefully.

Key changes:
- **Deleted Packages**: Packages that are not found on GitHub or are already tagged as 'deleted' are now moved to a new `deleted_packages.json` file, keeping the main `packages.json` clean.
- **Archived Packages**: Repositories that are archived on GitHub are now explicitly tagged with 'archived' and remain in `packages.json`.
- **Robust URL Parsing**: The script now uses `urllib.parse` to correctly handle GitHub URLs, stripping any query parameters or fragments.
- **Dynamic Commits**: The workflow now generates a detailed commit message listing the packages that were moved or tagged, and only commits if there are changes.
- **Forge Compatibility**: The GitHub-specific logic is now more carefully applied to only GitHub URLs, preventing errors with other forges.
* Update GitHub Action checkout to v5 for `actions/checkout`.
* Update GitHub Action setup-python to v5.
* Update git-auto-commit-action to v6.
* Enhance `tag_archived.py` to handle GitHub API results more robustly.
* Add support for tagging repositories as 'archived' based on API response.
* Move non-existent repositories to `deleted_packages.json`.
* Improve URL parsing to handle query parameters.
* Add `cglm` package to `packages.json`.
@Araq
Copy link
Member

Araq commented Aug 12, 2025

The Python script doesn't look like it's doing anything that Nim couldn't do just as easily.

@esafak
Copy link
Contributor Author

esafak commented Aug 12, 2025

Given that this script works and provides value I would do that in another PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handling deleted packages
2 participants