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
1 change: 1 addition & 0 deletions members/Defelo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2025-04-22
1 change: 1 addition & 0 deletions members/Enzime
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2025-08-20
1 change: 1 addition & 0 deletions members/FliegendeWurst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2024-12-06
1 change: 1 addition & 0 deletions members/LordGrimmauld
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2025-08-20
1 change: 1 addition & 0 deletions members/MattSturgeon
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2025-08-20
1 change: 1 addition & 0 deletions members/MatthewCroughan
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2024-10-07
1 change: 1 addition & 0 deletions members/NetaliDev
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2024-11-06
1 change: 1 addition & 0 deletions members/Scrumplex
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2024-10-20
1 change: 1 addition & 0 deletions members/ShamrockLee
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2024-12-01
1 change: 1 addition & 0 deletions members/SigmaSquadron
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2025-08-20
1 change: 1 addition & 0 deletions members/Sigmanificient
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2025-04-22
1 change: 1 addition & 0 deletions members/TomaSajt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2024-11-06
1 change: 1 addition & 0 deletions members/afh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2025-04-22
1 change: 1 addition & 0 deletions members/alexfmpe
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2024-11-06
1 change: 1 addition & 0 deletions members/anthonyroussel
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2024-10-07
1 change: 1 addition & 0 deletions members/artemist
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2025-01-20
1 change: 1 addition & 0 deletions members/baloo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2024-11-06
1 change: 1 addition & 0 deletions members/getchoo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2024-12-01
1 change: 1 addition & 0 deletions members/hsjobeki
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2025-01-20
1 change: 1 addition & 0 deletions members/isabelroses
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2025-04-22
1 change: 1 addition & 0 deletions members/jmbaur
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2025-08-20
1 change: 1 addition & 0 deletions members/khaneliman
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2024-11-06
1 change: 1 addition & 0 deletions members/m1cr0man
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2025-08-20
1 change: 1 addition & 0 deletions members/matteo-pacini
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2025-04-22
1 change: 1 addition & 0 deletions members/misuzu
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2024-12-01
1 change: 1 addition & 0 deletions members/msanft
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2025-01-20
1 change: 1 addition & 0 deletions members/niklaskorz
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2025-04-22
1 change: 1 addition & 0 deletions members/numinit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2025-04-22
1 change: 1 addition & 0 deletions members/phaer
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2025-04-22
1 change: 1 addition & 0 deletions members/pyrox0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2025-01-20
1 change: 1 addition & 0 deletions members/r-vdp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2024-10-07
1 change: 1 addition & 0 deletions members/rhelmot
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2025-01-20
1 change: 1 addition & 0 deletions members/stepbrobd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2025-04-22
1 change: 1 addition & 0 deletions members/tomodachi94
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2024-10-07
1 change: 1 addition & 0 deletions members/uninsane
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2024-11-06
1 change: 1 addition & 0 deletions members/wolfgangwalther
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2024-12-01
1 change: 1 addition & 0 deletions members/xanderio
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2024-12-01
16 changes: 11 additions & 5 deletions scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ Once you have the above setup (or got @infinisil to add yourself to his), you ha
To cover all code branches it's recommended to create, push to and delete a branch.
You can do this from the web interface.
- Get the GitHub CLI available (`pkgs.github-cli`) and authenticate it using `gh auth login`
- A local Git clone of this repository with the `origin` remote set to the test repository:
```bash
git remote add upstream git@github.com:NixOS/nixpkgs-committers.git
git remote set-url origin git@github.com:infinisil-test-org/nixpkgs-committers.git
```
Comment on lines +28 to +32

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is only needed because of the instructions below, as I read it, and not because the tool now relies on the git history. Is that correct?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually an unrelated change to just improve the testing, because the script always pushes to a remote named origin

I guess a separate commit would be in order, though I don't think it's essential


## Testing `sync.sh`

Expand All @@ -42,17 +47,18 @@ This script has external effects and as such needs a bit more care when testing.

### Setup (important!)

To avoid other users getting pings, ensure that the `members` directory contains only your own user, then commit and push it for testing:
To avoid other users getting pings, ensure that the `members` directory contains only a simulated new user and your own user (simulated to have been added over a year ago), then commit and push it for testing:

```bash
me=$(gh api /user --jq .login)
git switch -c "test-$me"
git switch -C "test-$me"
rm -rf members
mkdir members
touch "members/$me"
date +%F > "members/github"
date --date="1 year ago 1 day ago" +%F > "members/$me"
git add members
git commit -m testing
git push -u git@github.com:infinisil-test-org/nixpkgs-committers HEAD
git push -f -u origin HEAD
```

### Test sequence
Expand All @@ -71,7 +77,7 @@ The following sequence tests all code paths:
scripts/retire.sh infinisil-test-org empty nixpkgs-committers members 'yesterday 1 month ago'
```

Check that it would create a PR before running it again with `PROD=1` to actually do it:
Check that it would only create a PR for your own user and not the "github" user before running it again with `PROD=1` to actually do it:

```bash
PROD=1 scripts/retire.sh infinisil-test-org empty nixpkgs-committers members 'yesterday 1 month ago'
Expand Down
18 changes: 14 additions & 4 deletions scripts/retire.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,19 @@ effect() {
}

usage() {
log "Usage: $0 ORG ACTIVITY_REPO MEMBER_REPO DIR PR_CUTOFF_DATE"
log "Usage: $0 ORG ACTIVITY_REPO MEMBER_REPO DIR NOTICE_CUTOFF"
exit 1
}

ORG=${1:-$(usage)}
ACTIVITY_REPO=${2:-$(usage)}
MEMBER_REPO=${3:-$(usage)}
DIR=${4:-$(usage)}
CUTOFF_DATE=${5:-$(usage)}
NOTICE_CUTOFF=${5:-$(usage)}

mainBranch=$(git branch --show-current)
cutoffEpoch=$(date --date="$CUTOFF_DATE" +%s)
newCutoff=$(date --date="1 year ago" +%s)
noticeCutoff=$(date --date="$NOTICE_CUTOFF" +%s)

if [[ -z "${PROD:-}" ]]; then
tmp=$(git rev-parse --show-toplevel)/.tmp
Expand All @@ -52,6 +53,15 @@ fi
mkdir -p "$DIR"
cd "$DIR"
for login in *; do

# Don't remove people that have been added recently
if [[ -s "$login" ]]; then
epochAdded=$(date --date="$(<"$login")" +%s)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I support these "member files" becoming JSON and having much more information in them, in the fullness of time.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard to imagine what could go in it that wouldn't be in the maintainer list 🤔

if (( newCutoff < epochAdded )); then
continue
fi
fi

trace gh api -X GET /repos/"$ORG"/"$ACTIVITY_REPO"/activity \
-f time_period=year \
-f actor="$login" \
Expand All @@ -75,7 +85,7 @@ for login in *; do
# If there is a PR already
prNumber=$(jq .number <<< "$prInfo")
epochCreatedAt=$(date --date="$(jq -r .created_at <<< "$prInfo")" +%s)
if jq -e .draft <<< "$prInfo" >/dev/null && (( epochCreatedAt < cutoffEpoch )); then
if jq -e .draft <<< "$prInfo" >/dev/null && (( epochCreatedAt < noticeCutoff )); then
log "$login has a retirement PR due, unmarking PR as draft and commenting with next steps"
effect gh pr ready --repo "$ORG/$MEMBER_REPO" "$prNumber"
{
Expand Down
19 changes: 10 additions & 9 deletions scripts/sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,17 @@ ORG=${1:-$(usage)}
TEAM=${2:-$(usage)}
DIR=${3:-$(usage)}

shopt -s nullglob

mkdir -p "$DIR"
cd "$DIR"

for login in *; do
rm "$login"
done
mkdir -p "$DIR.new"

gh api /orgs/"$ORG"/teams/"$TEAM"/members --paginate --jq '.[].login' |
while read -r login; do
touch "$login"
if [[ -f "$DIR/$login" ]]; then
mv "$DIR/$login" "$DIR.new"
else
# Keep track of when the user was added
date +%F > "$DIR.new/$login"
fi
done

rm -rf "$DIR"
mv "$DIR.new" "$DIR"