Skip to content

Commit

Permalink
ci(workflows): improved workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahmad Nassri committed May 27, 2021
1 parent ac71dd4 commit c910498
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 130 deletions.
112 changes: 0 additions & 112 deletions .github/workflows/pull_request.yml

This file was deleted.

34 changes: 26 additions & 8 deletions .github/workflows/pull_request_target.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,47 @@ on: pull_request_target
name: pull_request_target

jobs:
auto-merge:
# only run for dependabot
if: github.actor == 'dependabot[bot]'
metadata:
runs-on: ubuntu-latest

outputs:
repository: ${{ steps.metadata.outputs.repository }}

steps:
- uses: actions/[email protected]

- uses: ahmadnassri/action-metadata@v1
id: metadata

auto-merge:
timeout-minutes: 5

runs-on: ubuntu-latest

# only run for dependabot PRs
if: ${{ github.actor == 'dependabot[bot]' }}

steps:
- uses: actions/checkout@v2
- uses: ahmadnassri/[email protected]
with:
github-token: ${{ secrets.GH_TOKEN }}

template-sync:
needs: metadata

timeout-minutes: 20

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
# only run for templates
if: ${{ fromJSON(needs.metadata.outputs.repository).is_template }}

- uses: ahmadnassri/action-template-repository-sync@v1
steps:
- uses: actions/[email protected]
with:
ref: ${{ github.event.pull_request.head.ref }}
- uses: ahmadnassri/[email protected]
- uses: ahmadnassri/[email protected]
- uses: ahmadnassri/[email protected]
with:
github-token: ${{ secrets.GH_TOKEN }}
dry-run: true
37 changes: 27 additions & 10 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
# ------------------------------------------------------------- #
# Note: this file is automatically managed in template-template #
# Note: this file is automatically managed in template-node-lib #
# ------------------------------------------------------------- #

on: push

name: push

jobs:
metadata:
runs-on: ubuntu-latest

outputs:
repository: ${{ steps.metadata.outputs.repository }}

steps:
- uses: actions/[email protected]

- uses: ahmadnassri/action-metadata@v1
id: metadata

commit-lint:
timeout-minutes: 5

Expand All @@ -29,7 +41,7 @@ jobs:
with:
fetch-depth: 0

- uses: github/super-linter@v3.15.5
- uses: github/super-linter@v4.0.2
env:
LOG_LEVEL: ERROR
VALIDATE_ALL_CODEBASE: false
Expand All @@ -49,11 +61,6 @@ jobs:
- run: npm audit --audit-level=critical

test-strategy:
needs:
- commit-lint
- super-linter
- npm-audit

timeout-minutes: 5

runs-on: ubuntu-latest
Expand All @@ -67,7 +74,11 @@ jobs:
run: echo "::set-output name=matrix::$(jq -c . < .github/matrix.json)"

test-run:
needs: test-strategy
needs:
- commit-lint
- super-linter
- npm-audit
- test-strategy

timeout-minutes: 5

Expand All @@ -87,7 +98,7 @@ jobs:
with:
submodules: true

- uses: actions/[email protected].5
- uses: actions/[email protected].4
with:
path: ~/.npm
key: ${{ matrix.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
Expand Down Expand Up @@ -148,10 +159,16 @@ jobs:
npm publish
template-sync:
needs: release
needs:
- metadata
- release

timeout-minutes: 20

# only runs on main branch and only for the template
if: ${{ github.ref == 'refs/heads/master' &&
fromJSON(needs.metadata.outputs.repository).is_template }}

runs-on: ubuntu-latest

steps:
Expand Down

0 comments on commit c910498

Please sign in to comment.