diff --git a/.github/workflows/test-pull-request.yml b/.github/workflows/test-pull-request.yml index b755be3..4eeaad1 100644 --- a/.github/workflows/test-pull-request.yml +++ b/.github/workflows/test-pull-request.yml @@ -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 diff --git a/.github/workflows/validate-pr_job.yml b/.github/workflows/validate-pr_job.yml new file mode 100644 index 0000000..afdebfe --- /dev/null +++ b/.github/workflows/validate-pr_job.yml @@ -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