Skip to content

updated

updated #1

name: Add Contributor to README
on:
pull_request:
types:
- closed
push:
branches:
- main
permissions:
contents: write
jobs:
add-contributor:
if: github.event_name == 'push' || github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Get PR author username
if: github.event_name == 'pull_request'
id: get_author
run: echo "username=${{ github.event.pull_request.user.login }}" >> $GITHUB_OUTPUT
- name: Get committer username (for push)
if: github.event_name == 'push'
id: get_author

Check failure on line 34 in .github/workflows/add-contributor-on-merge.yml

View workflow run for this annotation

GitHub Actions / Add Contributor to README

Invalid workflow file

The workflow is not valid. .github/workflows/add-contributor-on-merge.yml (Line: 34, Col: 13): The identifier 'get_author' may not be used more than once within the same scope.
run: echo "username=${{ github.actor }}" >> $GITHUB_OUTPUT
- name: Add contributor to README
env:
CONTRIBUTOR_USERNAME: ${{ steps.get_author.outputs.username }}
run: |
node .github/scripts/add-contributor.js
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore: add ${{ steps.get_author.outputs.username }} to Contributors in README"
branch: main