Skip to content

Turn off gcloudignore parsing as we do not have one, to suppress warnings #1099

Turn off gcloudignore parsing as we do not have one, to suppress warnings

Turn off gcloudignore parsing as we do not have one, to suppress warnings #1099

Workflow file for this run

name: Add new contributor to AUTHORS.md
on:
pull_request_target:
types:
- closed
jobs:
update-authors:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Checkout develop branch
uses: actions/checkout@v4
with:
ref: 'develop'
fetch-depth: 0
persist-credentials: false
- name: Check if author is in AUTHORS.md
id: check-author
run: |
GH_USER="${{ github.event.pull_request.user.login }}"
# AUTHORS.md file already exist in repo, so can skip the conditional logic to create one if not exists
if ! grep -q "| ${GH_USER} |" AUTHORS.md; then
echo "new_author=true" >> $GITHUB_ENV
else
echo "new_author=false" >> $GITHUB_ENV
fi
- name: Add author to AUTHORS.md if not present
if: env.new_author == 'true'
run: |
GH_USER="${{ github.event.pull_request.user.login }}"
AUTHOR_NAME=$(curl -s https://api.github.com/users/${GH_USER} | jq -r '.name')
if [ -z "$AUTHOR_NAME" ]; then
AUTHOR_NAME="-"
fi
echo "| $AUTHOR_NAME | $GH_USER |" >> AUTHORS.md
- name: Commit updated AUTHORS.md
if: env.new_author == 'true'
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add AUTHORS.md
git commit -m "Add ${{ github.event.pull_request.user.login }} to AUTHORS.md"
- name: GitHub App token
if: env.new_author == 'true'
uses: tibdex/github-app-token@v2
id: generate-token
with:
app_id: ${{ secrets.LE_BOT_APP_ID }}
private_key: ${{ secrets.LE_BOT_PRIVATE_KEY }}
- name: Push changes to develop
if: env.new_author == 'true'
uses: ad-m/github-push-action@v0.8.0
with:
github_token: ${{ steps.generate-token.outputs.token }}
branch: 'develop'