diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml deleted file mode 100644 index d22f9e1..0000000 --- a/.github/workflows/pull_request.yml +++ /dev/null @@ -1,112 +0,0 @@ -# ------------------------------------------------------------- # -# Note: this file is automatically managed in template-template # -# ------------------------------------------------------------- # - -on: pull_request - -name: pull_request - -jobs: - pr-screen: - runs-on: ubuntu-20.04 - - # only run for external PRs - if: github.event.pull_request.head.repo.full_name != github.repository - - steps: - - run: echo ::debug::pr screen complete - working-directory: ${{ github.workspace }} - - commit-lint: - needs: pr-screen - - timeout-minutes: 5 - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - uses: ahmadnassri/action-commit-lint@v1 - with: - config: .github/linters/.commit-lint.yml - - super-linter: - needs: pr-screen - - timeout-minutes: 5 - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - uses: github/super-linter@v3.15.5 - env: - LOG_LEVEL: ERROR - VALIDATE_ALL_CODEBASE: false - FILTER_REGEX_EXCLUDE: '/github/workspace/README.md|test/fixtures/*' - GITHUB_TOKEN: ${{ github.token }} - - npm-audit: - needs: pr-screen - - timeout-minutes: 5 - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - uses: actions/setup-node@v2.1.5 - - - run: npm audit --audit-level=critical - - test-strategy: - needs: - - commit-lint - - super-linter - - npm-audit - - timeout-minutes: 5 - - runs-on: ubuntu-latest - - outputs: - matrix: ${{ steps.parse.outputs.matrix }} - - steps: - - uses: actions/checkout@v2 - - id: parse - run: echo "::set-output name=matrix::$(jq -c . < .github/matrix.json)" - - test-run: - needs: test-strategy - - timeout-minutes: 5 - - name: ${{ matrix.name || format('node v{0} @ {1}', matrix.node-version, matrix.os) || 'test-step' }} - - strategy: - matrix: ${{ fromJSON(needs.test-strategy.outputs.matrix) }} - - runs-on: ${{ matrix.os }} - - steps: - - uses: actions/setup-node@v2.1.5 - with: - node-version: ${{ matrix.node-version }} - - - uses: actions/checkout@v2 - with: - submodules: true - - - uses: actions/cache@v2.1.5 - with: - path: ~/.npm - key: ${{ matrix.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }} - - - run: npm ci - - run: npm run test:ci diff --git a/.github/workflows/pull_request_target.yml b/.github/workflows/pull_request_target.yml index 748965f..cd1397e 100644 --- a/.github/workflows/pull_request_target.yml +++ b/.github/workflows/pull_request_target.yml @@ -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/checkout@v2.3.4 + + - 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/action-dependabot-auto-merge@v2.4 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/checkout@v2.3.4 + with: + ref: ${{ github.event.pull_request.head.ref }} + - uses: ahmadnassri/action-workflow-queue@v1.1 + - uses: ahmadnassri/action-template-repository-sync@v1.6.0 + - uses: ahmadnassri/action-workflow-queue@v1.1 with: github-token: ${{ secrets.GH_TOKEN }} - dry-run: true diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 460b4a7..479209b 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -1,5 +1,5 @@ # ------------------------------------------------------------- # -# Note: this file is automatically managed in template-template # +# Note: this file is automatically managed in template-node-lib # # ------------------------------------------------------------- # on: push @@ -7,6 +7,18 @@ on: push name: push jobs: + metadata: + runs-on: ubuntu-latest + + outputs: + repository: ${{ steps.metadata.outputs.repository }} + + steps: + - uses: actions/checkout@v2.3.4 + + - uses: ahmadnassri/action-metadata@v1 + id: metadata + commit-lint: timeout-minutes: 5 @@ -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 @@ -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 @@ -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 @@ -87,7 +98,7 @@ jobs: with: submodules: true - - uses: actions/cache@v2.1.5 + - uses: actions/cache@v2.1.4 with: path: ~/.npm key: ${{ matrix.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }} @@ -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: