diff --git a/.github/credits.md b/.github/credits.md new file mode 100644 index 0000000..217d139 --- /dev/null +++ b/.github/credits.md @@ -0,0 +1,9 @@ +### Timestamp: +2023-11-27T18:38:19Z +### Contributor: +qcdyx +#### PR Number: +161 +#### PR Title: +feat: added github action that records contributor and PR info in credits.md file +######################################################################################## diff --git a/.github/workflows/update-credits.yml b/.github/workflows/update-credits.yml new file mode 100644 index 0000000..395b582 --- /dev/null +++ b/.github/workflows/update-credits.yml @@ -0,0 +1,35 @@ +name: Update Credits upon creating PR + +on: + pull_request: + branches: + - master + types: + - opened + - synchronize + +jobs: + update-credits: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.ref }} + - run: | + echo "### Timestamp:" >> .github/credits.md + echo "$(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> .github/credits.md + echo "### Contributor:" >> .github/credits.md + echo "${{ github.event.pull_request.user.login }}" >> .github/credits.md + echo "#### PR Number:" >> .github/credits.md + echo "${{ github.event.pull_request.number }}" >> .github/credits.md + echo "#### PR Title:" >> .github/credits.md + echo "${{ github.event.pull_request.title }}" >> .github/credits.md + echo "########################################################################################" >> .github/credits.md + + git add .github/credits.md + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git commit -m "Update credits.md with contributor information" + git push origin ${{ github.event.pull_request.head.ref}} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}