Skip to content

Commit

Permalink
Merge pull request #827 from shinya/feature/build-auto-merge
Browse files Browse the repository at this point in the history
自動マージの仕組みを導入
  • Loading branch information
dotani1111 authored Feb 5, 2024
2 parents 21c0025 + d68e826 commit 41a96a0
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 24 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Auto-merge

on:
workflow_run:
workflows: [E2E testing for EC-CUBE]
types: [completed]

jobs:
check-and-merge:
runs-on: ubuntu-latest
if: |
github.event.workflow_run.conclusion == 'success'
permissions:
pull-requests: write
contents: write
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Approve PR
run: gh pr review "$PR_URL" --approve
## いきなりマージするのが怖いので、一旦自動承認(↑)だけにする
#- name: Enable auto-merge
# run: gh pr merge --merge --auto "$PR_URL"

failed:
runs-on: ubuntu-latest
if: |
github.event.workflow_run.conclusion == 'failure'
steps:
- name: failed
# 失敗したときにデバッグ用に情報を出力しておく
run: |
echo 'Haven't met the conditions to merge yet'
echo '${{ toJSON(github.event.workflow_run) }}'
exit 1
22 changes: 10 additions & 12 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
name: E2E testing for EC-CUBE
run-name: E2E testing for EC-CUBE

on:
push:
branches:
- '*'
tags:
- '*'
paths:
- '**'
- '!*.md'
pull_request:
paths:
- '**'
- '!*.md'
workflow_run:
workflows: [CI/CD for EC-CUBE]
types: [completed]

jobs:
run-on-linux:
name: Run on Linux
runs-on: ubuntu-22.04
if: |
github.event.workflow_run.conclusion == 'success'
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -85,6 +81,8 @@ jobs:
installer:
name: Installer test
runs-on: ubuntu-22.04
if: |
github.event.workflow_run.conclusion == 'success'
strategy:
fail-fast: false
matrix:
Expand Down
22 changes: 10 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
name: CI/CD for EC-CUBE
run-name: CI/CD for EC-CUBE

on:
push:
branches:
- '*'
tags:
- '*'
paths:
- '**'
- '!*.md'
pull_request:
paths:
- '**'
- '!*.md'
workflow_run:
workflows: [PHPStan]
types: [completed]

jobs:
run-on-linux:
name: Run on Linux
runs-on: ${{ matrix.operating-system }}
if: |
github.event.workflow_run.conclusion == 'success'
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -150,6 +146,8 @@ jobs:
run-on-windows:
name: Run on Windows
runs-on: ${{ matrix.operating-system }}
if: |
github.event.workflow_run.conclusion == 'success'
strategy:
fail-fast: false
matrix:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
name: PHPStan
run-name: PHPStan

on:
push:
branches:
Expand All @@ -12,6 +14,8 @@ on:
paths:
- '**'
- '!*.md'
pull_request_review:
types: [submitted]

jobs:
phpstan:
Expand Down

0 comments on commit 41a96a0

Please sign in to comment.