fix: Comment when test fails #62
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_target: | |
name: CI - Pull Request | |
jobs: | |
set-env: | |
name: "Set environment" | |
runs-on: ubuntu-latest | |
outputs: | |
env: ${{ steps.get_env.outputs.env }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
repository: ${{github.event.pull_request.head.repo.full_name}} | |
ref: ${{ github.head_ref }} | |
- name: Determine Environment | |
id: get_env | |
run: | | |
codeowners=$(cat .github/CODEOWNERS) | |
if [[ $(echo "${codeowners[@]}" | fgrep -w "@${{github.actor}}") ]]; then | |
echo PROWNER | |
echo "env=pr_owner" >> $GITHUB_OUTPUT | |
else | |
echo PR | |
echo "env=pr" >> $GITHUB_OUTPUT | |
fi | |
pull_request_checks: | |
needs: set-env | |
environment: ${{needs.set-env.outputs.env}} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
repository: ${{github.event.pull_request.head.repo.full_name}} | |
ref: ${{ github.head_ref }} | |
- uses: subosito/flutter-action@v2 | |
with: | |
cache: true | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "20.x" | |
- run: npm i | |
- run: yes | npx @vercel/ncc build src/main.ts | |
- name: setup flutter test repos | |
run: | | |
cd tests/fail_repo | |
flutter pub get | |
cd ../pass_repo | |
flutter pub get | |
cd ../.. | |
- name: run tests | |
run: npm run test | |
- name: Check for modified files | |
id: git-check | |
run: echo "modified=$(if [ -n "$(git status --porcelain)" ]; then echo "true"; else echo "false"; fi)" >> $GITHUB_ENV | |
- name: Update changes in GitHub repository | |
if: env.modified == 'true' | |
run: | | |
git config --global user.name "github-actions" | |
git config --global user.email "[email protected]" | |
git add -A | |
git commit -m 'ci(automated commit): Build bundled file' | |
git push |