Add example readme #39
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
on: | |
pull_request: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Reset local branch to match remote | |
run: | | |
git fetch origin | |
git reset --hard origin/${{ github.head_ref }} | |
- name: Delete CODEOWNERS file | |
run: | | |
rm -f CODEOWNERS | |
- uses: gagoar/codeowners-generator@master | |
with: | |
use-maintainers: true | |
- name: Add default CODEOWNERS | |
run: | | |
echo -e "\n# Default Codeowners\n* @kimdhamilton @ottomorac" >> CODEOWNERS | |
- run: | | |
STATUS=$(git diff --quiet && echo clean || echo modified) | |
echo "status=$(echo $STATUS)" >> $GITHUB_OUTPUT | |
id: gitStatus | |
- run: | | |
echo ${{ steps.gitStatus.outputs.status }} | |
echo ${{ contains(steps.gitStatus.outputs.status, 'modified') }} | |
- name: Commit CODEOWNERS | |
if: contains(steps.gitStatus.outputs.status, 'modified') | |
run: | | |
set -x | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git add CODEOWNERS | |
git commit -m "update CODEOWNERS" | |
- name: Push changes | |
if: contains(steps.gitStatus.outputs.status, 'modified') | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.head_ref }} |