Skip to content

Commit

Permalink
More clarify for conflicts of interest disclosure
Browse files Browse the repository at this point in the history
We need to evaluate conflicts between the candidate and the endorser,
but also among endorsers.
The previous endorser email only implied the former, this commit
improves on that.

Since endorser disclosures aren't specific to a candidate anymore,
we also only send the email once.
  • Loading branch information
infinisil committed Sep 17, 2024
1 parent c4a6007 commit a77db06
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 11 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/nomination.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ jobs:
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.PRIVATE_KEY }}
- name: Get GitHub App User ID
id: get-user-id
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
- run: |
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com>'
- uses: actions/checkout@v4
with:
token: ${{ steps.app-token.outputs.token }}
Expand Down
5 changes: 2 additions & 3 deletions scripts/check-nomination.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ case "$EVENT" in
scripts/self-nomination.sh "$email" "$nomineeHandle"
else
scripts/other-nomination.sh "$email" "$nomineeHandle"
ENDORSER_ID="$NOMINATOR_ID" ENDORSER_LOGIN="$NOMINATOR_LOGIN" scripts/endorse.sh "$nomineeHandle"
ENDORSER_ID="$NOMINATOR_ID" ENDORSER_LOGIN="$NOMINATOR_LOGIN" scripts/endorse.sh
fi

gh api --method POST \
Expand All @@ -76,7 +76,6 @@ case "$EVENT" in
;;
issue_comment)
if [[ "$IS_ENDORSEMENT" == true ]]; then
getNominee
scripts/endorse.sh "$nomineeHandle"
scripts/endorse.sh
fi
esac
36 changes: 28 additions & 8 deletions scripts/endorse.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
#!/usr/bin/env bash
set -euo pipefail

nomineeHandle=$1
endorsersAskedFile=scripts/endorsersAsked.txt

touch "$endorsersAskedFile"

if grep "^$ENDORSER_ID$" "$endorsersAskedFile" >/dev/null; then
gh api \
--method POST \
"/repos/$REPOSITORY/issues/$PR_NUMBER/comments" \
-F "body=@-" << EOF
@$ENDORSER_LOGIN You've already been asked to disclose your conflicts of interest after a previous endorsement. So the endorsement is already complete if you replied to that email (sent to your [voter email address](https://github.com/$REPOSITORY/blob/main/doc/email.md)). If you never received that, check the spam folder or [get in touch with the EC](https://github.com/$REPOSITORY/tree/main?tab=readme-ov-file#election-committee-ec).
EOF
exit 0
fi

echo "Building the list of eligible voters"
nix-build -A voters
Expand All @@ -11,26 +23,34 @@ if ! endorserEmail=$(jq -er --arg id "$ENDORSER_ID" '."\($id)"' result/github-to
--method POST \
"/repos/$REPOSITORY/issues/$PR_NUMBER/comments" \
-F "body=@-" << EOF
@$ENDORSER_LOGIN You cannot endorse until you [set an email](https://github.com/NixOS/SC-election-2024/blob/main/doc/email.md).
@$ENDORSER_LOGIN You cannot endorse until you [set an email](https://github.com/$REPOSITORY/blob/main/doc/email.md). Please try again once set.
EOF
exit 0
fi
scripts/send-email.sh "$endorserEmail" "Nix SC Election 2024: Endorser conflicts of interest" <<EOF
Hello, @$ENDORSER_LOGIN
You've indicated that you'd like to endorse the
[nomination] of @$nomineeHandle as a candidate for the Nix Steering Committee.
You've indicated that you'd like to endorse a nominee for the Nix Steering Committee.
To complete the endorsement,
reply to this email with your [conflicts of interest].
reply to this email with a disclosure of _all_ your potential sources of conflicts of interest.
This includes, but is not limited to, employers or otherwise payers of Nix work.
[nomination]: https://github.com/$REPOSITORY/pull/$PR_NUMBER
[conflicts of interest]: https://github.com/$REPOSITORY/blob/main/doc/conflict-of-interest.md
We will use this disclosure to check for conflicts of interest with
any candidates you endorse but also their other endorsers.
As such, you will only receive this request once for this election.
Note that this disclosure will not be published.
EOF

echo "$ENDORSER_ID" >> "$endorsersAskedFile"
git add "$endorsersAskedFile"
git commit -m "Update list of endorsers asked"
git push

gh api \
--method POST \
"/repos/$REPOSITORY/issues/$PR_NUMBER/comments" \
-F "body=@-" << EOF
@$ENDORSER_LOGIN To complete your endorsement, please reply to the email asking for your conflicts of interest that has been sent to your [voter email address](https://github.com/NixOS/SC-election-2024/blob/main/doc/email.md). If it doesn't arrive within a couple minutes, check the spam folder or [get in touch with the EC](https://github.com/$REPOSITORY/tree/main?tab=readme-ov-file#election-committee-ec).
@$ENDORSER_LOGIN To complete your endorsement, please reply to the email asking for your conflicts of interest that has been sent to your [voter email address](https://github.com/$REPOSITORY/blob/main/doc/email.md). If it doesn't arrive within a couple minutes, check the spam folder or [get in touch with the EC](https://github.com/$REPOSITORY/tree/main?tab=readme-ov-file#election-committee-ec).
EOF

0 comments on commit a77db06

Please sign in to comment.