Skip to content
name: Validate New Contributor
on:
pull_request:
types: [opened, edited]
branches:
- main
paths:
- 'CONTRIBUTING.md'
workflow_call:
inputs:
pull-request-number:
required: true
type: string # NOTE: github has a bug with type: number
outputs:
email-address:
description: "The new contributor's 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-new-contributor:
runs-on: ubuntu-latest
outputs:
email-address: ${{ steps.validate-new-contributor.outputs.EMAIL_ADDRESS }}
steps:
- name: ⚙️ Set Pull Request Number
run: |
if [ "${{ github.event_name }}" == "pull_request" ]
then
echo "PR_NUM=${{ github.event.pull_request.number }}" >> $GITHUB_ENV
else
echo "PR_NUM=${{ inputs.pull-request-number }}" >> $GITHUB_ENV
fi
- name: 🛫 Checkout
uses: actions/checkout@v4
with:
ref: refs/pull/${{ env.PR_NUM }}/head
- uses: ocadotechnology/codeforlife-workspace/.github/actions/python/setup-environment@main
with:
checkout: 'false'
python-version: ${{ env.PYTHON_VERSION }}
working-directory: ${{ env.WORKING_DIR }}
- name: 🕵️ Validate New Contributor
id: validate-new-contributor
working-directory: ${{ env.WORKING_DIR }}
run: pipenv run python .