You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/workflows/sync.yml
-1Lines changed: 0 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -47,5 +47,4 @@ jobs:
47
47
branch: create-pull-request/sync
48
48
title: Automated sync
49
49
body: This is an automated PR to sync the member list in this repository to match the GitHub team members. This PR can be merged without taking any further action.
The recommended way to test these scripts is to run them in a GitHub test organisation with the right setup.
4
+
Since creating your own takes some time, you can just ask @infinisil to get added to his test setup instead,
5
+
whose identifiers will be used here.
6
+
7
+
## Setup
8
+
9
+
### One-time
10
+
11
+
-[infinisil-test-org](https://github.com/infinisil-test-org): A GitHub organisation you're part of
12
+
- Repositories:
13
+
-[infinisil-test-org/empty](https://github.com/infinisil-test-org/empty): An empty one with no activity on it
14
+
-[infinisil-test-org/active](https://github.com/infinisil-test-org/active): One where you have some activity
15
+
-[infinisil-test-org/nixpkgs-committers](https://github.com/infinisil-test-org/nixpkgs-committers): A fork of the upstream repo
16
+
17
+
Useful to keep the first two separate for testing, because it's not possible to "undo" activity on a repo.
18
+
-[@infinisil-test-org/actors](https://github.com/orgs/infinisil-test-org/teams/actors): A team you're part of, needs write access to the `active` and `nixpkgs-committers` repository
19
+
20
+
### Per-user
21
+
22
+
Once you have the above setup (or got @infinisil to add yourself to his), you have to prepare the following:
23
+
24
+
- Add some activity of yours to the `active` repo.
25
+
To cover all code branches it's recommended to create, push to and delete a branch.
26
+
You can do this from the web interface.
27
+
- Get the GitHub CLI available (`pkgs.github-cli`) and authenticate it using `gh auth login`
28
+
29
+
## Testing `sync.sh`
30
+
31
+
This script has no external effects and as such can be easily tested by running:
32
+
33
+
```bash
34
+
scripts/sync.sh infinisil-test-org actors members
35
+
```
36
+
37
+
Check that it synchronises the files in the `members` directory with the team members of the `actors` team.
38
+
39
+
## `retire.sh`
40
+
41
+
This script has external effects and as such needs a bit more care when testing.
42
+
43
+
### Setup (important!)
44
+
45
+
To avoid other users getting pings, ensure that the `members` directory contains only your own user, then commit and push it for testing:
46
+
47
+
```bash
48
+
me=$(gh api /user --jq .login)
49
+
git switch -c "test-$me"
50
+
rm -rf members
51
+
mkdir members
52
+
touch "members/$me"
53
+
git add members
54
+
git commit -m testing
55
+
git push -u [email protected]:infinisil-test-org/nixpkgs-committers HEAD
56
+
```
57
+
58
+
### Test sequence
59
+
60
+
The following sequence tests all code paths:
61
+
62
+
1. Run the script with the `active` repo argument to simulate CI running without inactive users:
63
+
```bash
64
+
scripts/retire.sh infinisil-test-org active nixpkgs-committers members 'yesterday 1 month ago'
65
+
```
66
+
67
+
Check that no PR would be opened.
68
+
2. Run the script with the `empty` repo argument to simulate CI running with inactive users:
69
+
70
+
```bash
71
+
scripts/retire.sh infinisil-test-org empty nixpkgs-committers members 'yesterday 1 month ago'
72
+
```
73
+
74
+
Check that it would create a PR before running it again with `PROD=1` to actually do it:
75
+
76
+
```bash
77
+
PROD=1 scripts/retire.sh infinisil-test-org empty nixpkgs-committers members 'yesterday 1 month ago'
78
+
```
79
+
80
+
Check that it created the PR appropriately.
81
+
You can undo this step by closing the PR.
82
+
3. Run it again to simulate CI running again later:
83
+
```bash
84
+
PROD=1 scripts/retire.sh infinisil-test-org empty nixpkgs-committers members 'yesterday 1 month ago'
85
+
```
86
+
Check that no other PR is opened.
87
+
4. Run it again with `now` as the date to simulate the time interval passing:
88
+
```bash
89
+
PROD=1 scripts/retire.sh infinisil-test-org empty nixpkgs-committers members now
90
+
```
91
+
Check that it undrafted the previous PR and posted an appropriate comment.
92
+
5. Run it again to simulate CI running again later:
93
+
```bash
94
+
PROD=1 scripts/retire.sh infinisil-test-org empty nixpkgs-committers members now
95
+
```
96
+
6. Reset by marking the PR as a draft again.
97
+
7. Run it again with the `active` repo argument to simulate activity during the time interval:
98
+
```bash
99
+
PROD=1 scripts/retire.sh infinisil-test-org active nixpkgs-committers members now
0 commit comments