Skip to content

[T7148]bad_connector_woocommerce:Refund Request Management of WooCommerce BAD-SIP. #530

[T7148]bad_connector_woocommerce:Refund Request Management of WooCommerce BAD-SIP.

[T7148]bad_connector_woocommerce:Refund Request Management of WooCommerce BAD-SIP. #530

Workflow file for this run

name: pre-commit
on:
pull_request:
branches:
- "16.0*"
push:
branches:
- "16.0"
- "16.0-develop"
- "release/*"
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.11"
- name: Get python version
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- uses: actions/cache@v1
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Install pre-commit
run: pip install pre-commit
- name: Get target branch name
run: echo "TARGET_BRANCH_NAME=${{ github.event.pull_request.base.ref }}" >> $GITHUB_ENV
- name: Enforce target branch can not be main branch
run: |
if [[ "${TARGET_BRANCH_NAME}" =~ \.0$ ]]; then
echo "Error: Target branch can not be a Main version branch."
exit 1
fi
- name: Run pre-commit
run: pre-commit run --all-files --show-diff-on-failure --color=always || exit 1
- name: Check that all files generated by pre-commit are in git
run: |
newfiles="$(git ls-files --others --exclude-from=.gitignore)"
if [ "$newfiles" != "" ] ; then
echo "Please check-in the following files:"
echo "$newfiles"
exit 1
fi
- name: Post pre-commit failure comment and add label
if: failure()
run: |
# Add label
curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels \
-d '{
"labels": ["Needs Fixing"]
}'
# Post comment
curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments \
-d '{
"body": "Pre-commit checks failed. The label Needs Fixing has been added. Please review and fix the issues."
}'