Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions .github/workflows/add-contributor-on-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ on:
pull_request:
types:
- closed
push:
branches:
- main

permissions:
contents: write


jobs:
add-contributor:
if: github.event.pull_request.merged == true
if: github.event_name == 'push' || github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Checkout repo
Expand All @@ -23,9 +25,15 @@ jobs:
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
run: echo "username=${{ github.actor }}" >> $GITHUB_OUTPUT

- name: Add contributor to README
env:
CONTRIBUTOR_USERNAME: ${{ steps.get_author.outputs.username }}
Expand All @@ -36,4 +44,4 @@ jobs:
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore: add ${{ steps.get_author.outputs.username }} to Contributors in README"
branch: ${{ github.event.pull_request.base.ref }}
branch: main