Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 5 additions & 77 deletions .github/workflows/test-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,85 +16,13 @@
######################################################
on: pull_request

#################################################
# Disable all permissions on the workflow level #
#################################################
permissions: {}
permissions:
contents: read
statuses: write

###############
# Set the Job #
###############
jobs:
lint:
# Set the agent to run on
runs-on: ubuntu-latest

############################################
# Grant status permission for MULTI_STATUS #
############################################
permissions:
contents: read
statuses: write

##################
# Load all steps #
##################
steps:
##########################
# Checkout the code base #
##########################
- name: Checkout Code
uses: actions/checkout@v4
with:
# Full git history is needed to get a proper list of changed files
# within `super-linter`
fetch-depth: 0
- name: Load super-linter configuration
run: cat .github/super-linter.env >> "$GITHUB_ENV"

################################
# Run Linters against code base #
################################
- name: Lint Code Base
#
# Use full version number to avoid cases when a next
# released version is buggy
# About slim image: https://github.com/github/super-linter#slim-image
uses: super-linter/super-linter/slim@v7.2.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEFAULT_BRANCH: main

test:
runs-on: ubuntu-latest
needs: lint
permissions:
contents: read
statuses: write
steps:
- uses: actions/checkout@v4
- name: Use Setup Node and Install Dependencies Action
uses: commerce-docs/devsite-install-action@main
with:
node-version-file: '.nvmrc'
cache-dependency-path: 'yarn.lock'

- name: Check links
run: yarn test

build:
runs-on: ubuntu-latest
needs: test
permissions:
contents: read
statuses: write
steps:
- uses: actions/checkout@v4
- name: Use Setup Node and Install Dependencies Action
uses: commerce-docs/devsite-install-action@main
with:
node-version-file: '.nvmrc'
cache-dependency-path: 'yarn.lock'

- name: Build site
run: yarn build
validate:
uses: commerce-docs/commerce-testing/.github/workflows/validate-pr_job.yml@ds_pr-test-wf
54 changes: 54 additions & 0 deletions .github/workflows/validate-pr_job.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
name: Validate pull request

on: workflow_call

permissions:
contents: read
statuses: write

jobs:
lint-test:
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Load super-linter configuration
run: cat .github/super-linter.env >> "$GITHUB_ENV"

- name: Lint Code Base
uses: super-linter/super-linter/slim@v7.2.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEFAULT_BRANCH: main

remark-test:
runs-on: ubuntu-latest
needs: lint-test
steps:
- uses: actions/checkout@v4
- name: Use Setup Node and Install Dependencies Action
uses: commerce-docs/devsite-install-action@main
with:
node-version-file: '.nvmrc'
cache-dependency-path: 'yarn.lock'

- name: Check links
run: yarn test

build-test:
runs-on: ubuntu-latest
needs: remark-test
steps:
- uses: actions/checkout@v4
- name: Use Setup Node and Install Dependencies Action
uses: commerce-docs/devsite-install-action@main
with:
node-version-file: '.nvmrc'
cache-dependency-path: 'yarn.lock'

- name: Build site
run: yarn build