Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions commands/host/package-checker-and-card-maker
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ if [ "$BACKEND" = "glab" ]; then
list_projects() {
"${api[@]}" --paginate \
"groups/$GID/projects?include_subgroups=true&archived=false&per_page=100" \
| jq -rs '.[][] | select(.archived != true) | "\(.id)\t\(.path_with_namespace)\t\(.default_branch // "main")\t\(.web_url // "")"'
| jq -rs '.[][] | select(.archived != true) | "\(.id)\t\(.path_with_namespace)\t\(.default_branch // "main")\t\(.web_url // "")\t\(.name)"'
}
get_file() { # <id> <branch> <url-encoded path>
"${api[@]}" "projects/$1/repository/files/$3/raw?ref=$2" 2>/dev/null
Expand Down Expand Up @@ -128,7 +128,7 @@ else
resp=$(curl -sf "${hdr[@]}" \
"$GITLAB_URL/api/v4/groups/$GID/projects?include_subgroups=true&archived=false&per_page=100&page=$page")
[ "$(jq length <<<"$resp")" -eq 0 ] && break
jq -r '.[] | select(.archived != true) | "\(.id)\t\(.path_with_namespace)\t\(.default_branch // "main")\t\(.web_url // "")"' <<<"$resp"
jq -r '.[] | select(.archived != true) | "\(.id)\t\(.path_with_namespace)\t\(.default_branch // "main")\t\(.web_url // "")\t\(.name)"' <<<"$resp"
page=$((page+1))
done
}
Expand Down Expand Up @@ -249,7 +249,7 @@ matched_repos=0
made_urls=() # "repo<TAB>task-url" for the summary

echo "------------------------------------------------"
while IFS=$'\t' read -r id name branch web_url; do
while IFS=$'\t' read -r id name branch web_url title; do
scanned=$((scanned+1))
[ -n "${DEBUG:-}" ] && echo " scanning: $name ($branch)" >&2

Expand Down Expand Up @@ -297,12 +297,16 @@ while IFS=$'\t' read -r id name branch web_url; do
continue
fi

# Heading names the GitLab project; affected packages become a checklist so
# each one can be ticked off as it's updated.
checklist=$(printf -- '- [ ] %s\n' "${repo_pkgs[@]}")
card_desc="## $title"$'\n\n'"Please update:"$'\n\n'"${checklist%$'\n'}"

# Repos onboarded to Renovate get a link to their dashboard issue
card_desc="Please update $pkg_list"
renovate_url=""
if [ -n "$renovate_id" ] && [ -n "$web_url" ]; then
renovate_url="${web_url%/}/-/work_items/${renovate_id}"
card_desc="$card_desc"$'\n\n'"Renovate dashboard: $renovate_url"
card_desc="$card_desc"$'\n\n'"**Renovate dashboard:** $renovate_url"
fi

if $DRY_RUN; then
Expand Down
2 changes: 1 addition & 1 deletion docs/host-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ These commands run on the developer's host machine (via `ddev <command>`), from
- `mr` — Pushes the current branch and creates a draft GitLab MR via `glab mr create`, prefilling the title from the branch's `T-<id>` and description suffix.
- `open-board` — Opens the Teamwork board for the project, building the URL from `TEAMWORK_PROJECT_ID`/`TEAMWORK_DOMAIN` in `.ddev/.env.anner`. Aliases: `tw-board`.
- `open-issue` — Opens the Teamwork task URL for the `T-<id>` in the current branch name and copies it to the clipboard; falls back to the previous branch if needed. Pass `-c` to copy (and print) the URL only, without opening a browser. Aliases: `tw-open`.
- `package-checker-and-card-maker` — Combines `package-checker` with automatic Teamwork card creation: scans every project in a GitLab group for one or more Composer packages and creates an "Update Dependencies" card on each matching project's Teamwork board. Reads `TEAMWORK_PROJECT_ID` from the repo's `.ddev/.env.anner`. Supports `--dry-run` (show what would happen without creating cards) and `--auto-assign` (assigns the card to the people whose IDs are stored as `TEAMWORK_DEPUTY_ID`, `TEAMWORK_GUARDIAN_ID`, and `TEAMWORK_DM_ID` in the same `.env.anner`). Uses the same GitLab backend (glab or curl) and package/version-range syntax as `package-checker`, and additionally accepts a full drupal.org "Affected versions" constraint as the version suffix, e.g. `ddev paccma 'drupal/core:>=11.4.0 <11.4.7'`. Requires `TEAMWORK_API_KEY` and `TEAMWORK_DOMAIN`. Aliases: `paccma`, `paccman`.
- `package-checker-and-card-maker` — Combines `package-checker` with automatic Teamwork card creation: scans every project in a GitLab group for one or more Composer packages and creates an "Update Dependencies" card on each matching project's Teamwork board. The description names the GitLab project (its display title, not its path slug) as a heading, followed by a checklist of the affected packages. Reads `TEAMWORK_PROJECT_ID` from the repo's `.ddev/.env.anner`. Supports `--dry-run` (show what would happen without creating cards) and `--auto-assign` (assigns the card to the people whose IDs are stored as `TEAMWORK_DEPUTY_ID`, `TEAMWORK_GUARDIAN_ID`, and `TEAMWORK_DM_ID` in the same `.env.anner`). Uses the same GitLab backend (glab or curl) and package/version-range syntax as `package-checker`, and additionally accepts a full drupal.org "Affected versions" constraint as the version suffix, e.g. `ddev paccma 'drupal/core:>=11.4.0 <11.4.7'`. Requires `TEAMWORK_API_KEY` and `TEAMWORK_DOMAIN`. Aliases: `paccma`, `paccman`.
- `package-checker` — Scans every project in a GitLab group for usage (and version) of one or more Composer packages (`vendor/package` or `vendor/package:max-insecure-version`, OR-matched) by reading each project's `composer-manifest.yaml`, optionally flagging insecure versions; a project is reported as a single aggregated line listing every matching package, in red if any match is insecure. Aliases: `wtfiow`.
- `protect` — Enables/disables/resets HTTP basic-auth protection on a nixOS-hosted dev project via nginx config and htpasswd; no-ops unless `ANNERTECH_LOCAL_DEV` is set.
- `remote-db` — Pulls the latest database (skipping files) from the configured upstream provider (`DDEV_UPSTREAM_PROVIDER` in `.ddev/.env.anner`) via `ddev pull <provider> --skip-files -y`.
Expand Down