Create Learn.md #5
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 Contributors | |
on: | |
pull_request: | |
types: [closed] | |
jobs: | |
add-contributor: | |
if: github.event.pull_request.merged == true | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
- name: Install all-contributors-cli | |
run: npm install -g all-contributors-cli | |
- name: Configure git | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
- name: Add contributor | |
run: | | |
CONTRIBUTOR=$(jq -r '.pull_request.user.login' "$GITHUB_EVENT_PATH") | |
npx all-contributors-cli add $CONTRIBUTOR code,doc | |
npx all-contributors-cli generate | |
git add . | |
git commit -m "docs: add @$CONTRIBUTOR as a contributor for code, doc" | |
git push |