make project open to contributions #39
Workflow file for this run
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
name: Build 👷🏻♂️ | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install dependencies | |
run: npm install | |
- name: Lint code | |
run: npm run lint | |
- name: Build app | |
run: npm run build | |
- name: Check for Lint/Build Errors | |
if: failure() | |
run: | | |
if [ -s "$(git diff --name-only ${{ github.sha }} ${{ github.event.before }})" ]; then | |
echo "Linting or build errors detected." | |
curl -X POST \ | |
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.number }}/comments \ | |
-d '{"body": "Linting or build errors detected. Please review and address the issues before merging."}' | |
exit 1 | |
fi | |
- name: If No Errors, Merge | |
if: success() | |
run: | | |
if [ -z "$(git diff --name-only ${{ github.sha }} ${{ github.event.before }})" ]; then | |
echo "No linting or build errors detected. Merging." | |
curl -X PUT \ | |
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.number }}/merge \ | |
-d '{"commit_title": "You Rock Thank you for your contribution! One core maintainer will review your changes and merge them if they are approved."}' | |
fi |