Skip to content

Commit

Permalink
validate new contributor
Browse files Browse the repository at this point in the history
  • Loading branch information
SKairinos committed Jan 6, 2024
1 parent 7df3b9b commit 33c7ec4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
10 changes: 5 additions & 5 deletions .github/scripts/python/validate-new-contributor/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,11 @@ def get_email_address(diff_line_index: int, diff_line: str):
return signed_email_address


def write_to_github_env(**env_vars):
"""Write the environment variables to GitHub's environment."""
def write_to_github_output(**env_vars):
"""Write to GitHub's output."""

with open(os.environ["GITHUB_ENV"], "a", encoding="utf-8") as github_env:
github_env.write(
with open(os.environ["GITHUB_OUTPUT"], "a", encoding="utf-8") as github_out:
github_out.write(
"\n".join([f"{key}={value}" for key, value in env_vars.items()])
)

Expand All @@ -198,7 +198,7 @@ def main():

email_address = get_email_address(diff_line_index, diff_line)

write_to_github_env(CONTRIBUTOR_EMAIL_ADDRESS=email_address)
write_to_github_output(EMAIL_ADDRESS=email_address)


if __name__ == "__main__":
Expand Down
18 changes: 7 additions & 11 deletions .github/workflows/validate-new-contributor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ on:
outputs:
email-address:
description: "The new contributor's email address."
value: ${{ jobs.validate.outputs.email-address }}
value: ${{ jobs.validate-new-contributor.outputs.email-address }}

env:
PYTHON_VERSION: 3.11
WORKING_DIR: .github/scripts/python/validate-new-contributor

jobs:
validate:
validate-new-contributor:
runs-on: ubuntu-latest
outputs:
email-address: ${{ steps.output-email-address.outputs.EMAIL_ADDRESS }}
email-address: ${{ steps.validate-new-contributor.outputs.EMAIL_ADDRESS }}
steps:
- name: ⚙️ Set Pull Request Number
run: |
Expand All @@ -47,11 +47,7 @@ jobs:
python-version: ${{ env.PYTHON_VERSION }}
working-directory: ${{ env.WORKING_DIR }}

# - name: 🕵️ Validate New Contributor
# working-directory: ${{ env.WORKING_DIR }}
# run: pipenv run python validate_new_contributor.py

- name: 📧 Output Email Address
if: github.event_name != 'pull_request'
id: output-email-address
run: echo "EMAIL_ADDRESS=stefan.kairinos@ocado.com" >> $GITHUB_OUTPUT
- name: 🕵️ Validate New Contributor
id: validate-new-contributor
working-directory: ${{ env.WORKING_DIR }}
run: pipenv run python .

0 comments on commit 33c7ec4

Please sign in to comment.