-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from getchoo/small-fixes
- Loading branch information
Showing
7 changed files
with
116 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,27 @@ | ||
name: "Check that users contatains at least 1 point of contact" | ||
name: Check points of contact for users | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
paths: | ||
- 'users.nix' | ||
pull_request_target: | ||
paths: | ||
- 'users.nix' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
check-contacts: | ||
check: | ||
name: Run check | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Nix | ||
uses: cachix/install-nix-action@v12 | ||
- name: Install Nix | ||
uses: cachix/install-nix-action@v26 | ||
|
||
- name: Check users list | ||
run: nix-instantiate --eval checks/one-contacts.nix | ||
- name: Evaluate checks | ||
run: | | ||
nix eval --show-trace --file checks/check-contacts.nix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
let | ||
users = import ../users.nix; | ||
|
||
# This is how many contact points a user should have | ||
# besides GitHub | ||
requiredContactPoints = 1; | ||
|
||
# attrset -> attrset | ||
# We remove the GitHub attribute from all users, as we don't consider it | ||
# as a point of contact | ||
removeGH = userInfo: builtins.removeAttrs userInfo [ "github" ]; | ||
|
||
# attrset -> int | ||
# Count the number of attributes in a set | ||
# This is how we count the points of contact | ||
attrsLength = attrs: builtins.length (builtins.attrValues attrs); | ||
|
||
# attrset -> bool | ||
# Check to see if a set of user information attributes has the | ||
# number of contact points we require | ||
hasEnoughContacts = userInfo: attrsLength (removeGH userInfo) >= requiredContactPoints; | ||
|
||
# attrset -> attrset | ||
# This will check the contacts for a user and throw an evaluation | ||
# error if they don't meet our number of required contacts | ||
checkContact = | ||
userName: userInfo: | ||
if (!(hasEnoughContacts userInfo)) then | ||
throw "${userName} has less than ${toString requiredContactPoints} contact point(s)!" | ||
else | ||
userInfo; | ||
|
||
# This will run our contact check on each user | ||
checkContacts = builtins.mapAttrs checkContact users; | ||
|
||
# string -> string | ||
# This will evaluate our checks and display the message you give it if all goes well | ||
evalContactsThen = builtins.deepSeq checkContacts; | ||
in | ||
evalContactsThen "All users have at least ${toString requiredContactPoints} contact point(s)!" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,26 @@ | ||
{ | ||
description = | ||
"A project to declaratively add people to GitHub and their related SIG teams"; | ||
description = "A project to declaratively add people to GitHub and their related SIG teams"; | ||
|
||
inputs.nixpkgs.url = "github:auxolotl/nixpkgs/nixos-unstable"; | ||
|
||
outputs = { nixpkgs, ... }: | ||
outputs = | ||
{ nixpkgs, ... }: | ||
let | ||
systems = | ||
[ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; | ||
forAllSystems = nixpkgs.lib.genAttrs systems; | ||
pkgsFor = nixpkgs.legacyPackages; | ||
in { | ||
devShells = forAllSystems | ||
(system: { default = pkgsFor.${system}.callPackage ./shell.nix { }; }); | ||
systems = [ | ||
"x86_64-linux" | ||
"x86_64-darwin" | ||
"aarch64-linux" | ||
"aarch64-darwin" | ||
]; | ||
|
||
formatter = forAllSystems (system: pkgsFor.${system}.nixfmt); | ||
forAllSystems = | ||
function: nixpkgs.lib.genAttrs systems (system: function nixpkgs.legacyPackages.${system}); | ||
in | ||
{ | ||
devShells = forAllSystems (pkgs: { | ||
default = pkgs.callPackage ./shell.nix { }; | ||
}); | ||
|
||
formatter = forAllSystems (pkgs: pkgs.nixfmt-rfc-style); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,33 @@ | ||
let | ||
sigs = import ./sigs.nix; | ||
users = import ./users.nix; | ||
in [{ | ||
sig = sigs.documentation; | ||
leaders = [ users.coded users.minion ]; | ||
members = [ | ||
users.axel | ||
users.isabel | ||
users.ircurry | ||
users."8bitbuddhist" | ||
users.trespaul | ||
users.imadnyc | ||
users.aprl | ||
users.dfh | ||
users.vera | ||
users.nova | ||
users.blue | ||
users.deivpaukst | ||
users.tau | ||
users.srestegosaurio | ||
users.jacab | ||
users.liketechnik | ||
users.angryant | ||
users.raf | ||
]; | ||
}] | ||
in | ||
[ | ||
{ | ||
sig = sigs.documentation; | ||
leaders = [ | ||
users.coded | ||
users.minion | ||
]; | ||
members = [ | ||
users.axel | ||
users.isabel | ||
users.ircurry | ||
users."8bitbuddhist" | ||
users.trespaul | ||
users.imadnyc | ||
users.aprl | ||
users.dfh | ||
users.vera | ||
users.nova | ||
users.blue | ||
users.deivpaukst | ||
users.tau | ||
users.srestegosaurio | ||
users.jacab | ||
users.liketechnik | ||
users.angryant | ||
users.raf | ||
]; | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,2 @@ | ||
{ mkShell, python3, ... }: | ||
mkShell { | ||
packages = [ (python3.withPackages (pyPkgs: [ pyPkgs.pydiscourse ])) ]; | ||
} | ||
{ mkShellNoCC, python3, ... }: | ||
mkShellNoCC { packages = [ (python3.withPackages (pyPkgs: [ pyPkgs.pydiscourse ])) ]; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters