futtern/.forgejo/workflows/pull_request.yml

49 lines
1.9 KiB
YAML
Raw Normal View History

2024-06-10 17:16:55 +00:00
on: [pull_request]
jobs:
ls:
runs-on: docker
container:
image: git.php.fail/lubiana/container/php:ci
steps:
- name: Manually checkout
env:
REPO: '${{ github.repository }}'
TOKEN: '${{ secrets.GITHUB_TOKEN }}'
2024-09-23 17:09:18 +00:00
GIT_SERVER: 'git.hannover.ccc.de'
2024-06-10 17:16:55 +00:00
run: |
git clone --branch $GITHUB_HEAD_REF https://${TOKEN}@${GIT_SERVER}/${REPO}.git .
git fetch
git checkout $GITHUB_HEAD_REF
- name: composer install
env:
COMPOSER_CACHE_DIR: /opt/hostedtoolcache/.composer/cache/files
run: |
mkdir -p ${{ env.COMPOSER_CACHE_DIR }}
composer install
- name: lint
run: composer lint
- name: test
2024-09-15 20:11:42 +00:00
run: composer mutation
- name: Add comment to pull request
run: |
2024-09-17 16:16:41 +00:00
echo '```' >> /tmp/pull-request-comment
2024-09-15 20:11:42 +00:00
cat var/log/infection.txt >> /tmp/pull-request-comment
cat var/log/summary.log >> /tmp/pull-request-comment
2024-09-17 16:16:41 +00:00
echo '```' >> /tmp/pull-request-comment
jq -n --arg msg "$(cat /tmp/pull-request-comment)" '{"body": $msg}' > /tmp/git-msg
2024-09-15 20:11:42 +00:00
curl -X POST \
-H "Authorization: token ${GITHUB_TOKEN}" \
-H "Content-Type: application/json" \
2024-09-17 16:16:41 +00:00
-d @/tmp/git-msg \
"${{ env.GITHUB_SERVER_URL }}/api/v1/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments"
2024-06-10 17:16:55 +00:00
- name: GIT commit and push all changed files
env:
CI_COMMIT_MESSAGE: Continuous Integration Fixes
CI_COMMIT_AUTHOR: Continuous Integration
run: |
if [[ -n "$(git status -s)" ]]; then
git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}"
git config --global user.email "gitbot@users.noreply.php.fail"
git commit -am "${{ env.CI_COMMIT_MESSAGE }}"
git push
fi