✋ [MEMBER] - daniel-cfa #7
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
name: "Add new member to django-commons" | |
on: | |
issues: | |
types: | |
- opened | |
- reopened | |
labels: | |
- "New member" | |
jobs: | |
add-member: | |
name: "Add new member" | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: write | |
pull-requests: write | |
env: | |
ISSUE_ID: ${{ github.event.issue.id }} | |
BRANCH_NAME: "add-user/${{ github.event.issue.id }}" | |
steps: | |
- name: Setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Get username to add | |
id: get_username | |
run: | |
python -c "print('USERNAME='+'✋ [MEMBER] - <your handle>'.split(' - ')[1])" >> $GITHUB_ENV | |
- name: Initialize mandatory git config | |
run: | | |
git config user.name "GitHub Actions" | |
git config user.email [email protected] | |
- name: Create branch | |
run: git checkout -b ${{ env.BRANCH_NAME }} | |
- name: Add user to the list | |
run: | | |
python scripts/add_member.py ${{ env.USERNAME }} | |
- name: Commit changes | |
run: | | |
git add terraform/production/org.tfvars | |
git commit -m "Add ${{ env.USERNAME }} to django-commons" | |
git push origin ${{ env.BRANCH_NAME }} | |
- name: Create pull request | |
run: | | |
gh pr create \ | |
--title "Add ${{ env.USERNAME }} to django-commons" \ | |
--body "Fix #${{ env.ISSUE_ID }}" \ | |
--base main \ | |
--head ${{ env.BRANCH_NAME }} | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |