Skip to content
This repository has been archived by the owner on Mar 9, 2024. It is now read-only.

Commit

Permalink
change: split workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
MeilCli committed May 21, 2022
1 parent 0eda8cf commit b41000c
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 23 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/ci-base-approve.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
on:
workflow_call:

jobs:
approve:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && github.actor == 'dependabot[bot]'
steps:
- id: metadata
uses: dependabot/fetch-metadata@v1.1.1
with:
github-token: '${{ secrets.GITHUB_TOKEN }}'
- if: steps.metadata.outputs.update-type == 'version-update:semver-patch' || steps.metadata.outputs.update-type == 'version-update:semver-minor'
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.MEILCLI_BOT }}
24 changes: 1 addition & 23 deletions .github/workflows/ci.yml → .github/workflows/ci-base-build.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
name: CI

on:
workflow_dispatch:
push:
branches:
- master
pull_request:
branches:
- master
workflow_call:

jobs:
build:
Expand Down Expand Up @@ -47,17 +39,3 @@ jobs:
assignees: 'MeilCli'
reviewers: 'MeilCli'
branch: 'update/action'
approve:
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'pull_request' && github.actor == 'dependabot[bot]'
steps:
- id: metadata
uses: dependabot/fetch-metadata@v1.1.1
with:
github-token: '${{ secrets.GITHUB_TOKEN }}'
- if: steps.metadata.outputs.update-type == 'version-update:semver-patch' || steps.metadata.outputs.update-type == 'version-update:semver-minor'
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.MEILCLI_BOT }}
11 changes: 11 additions & 0 deletions .github/workflows/ci-master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: CI-Master

on:
push:
branches:
- master

jobs:
build:
uses: ./.github/workflows/ci-base-build.yml
secrets: inherit
15 changes: 15 additions & 0 deletions .github/workflows/ci-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: CI-PR

on:
pull_request:
branches:
- master

jobs:
build:
uses: ./.github/workflows/ci-base-build.yml
secrets: inherit
approve:
uses: ./.github/workflows/ci-base-approve.yml
secrets: inherit
needs: build

0 comments on commit b41000c

Please sign in to comment.