Always allow access to a lesson if the lesson preview is enabled #6537
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Plugin Build | |
on: | |
- pull_request | |
- workflow_call | |
jobs: | |
build: | |
name: Plugin Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get npm cache directory | |
id: npm-cache | |
run: | | |
echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v3 | |
with: | |
path: ${{ steps.npm-cache.outputs.dir }} | |
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install JS dependencies | |
run: npm ci | |
- name: Install PHP dependencies and generate the third-party directory | |
uses: ./.github/actions/install-php | |
- name: Build Plugin | |
run: npm run build | |
- name: Decompress plugin | |
run: unzip sensei-lms.zip -d sensei-lms | |
- name: Store Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: sensei-lms-${{ github.event.pull_request.head.sha }} | |
path: ${{ github.workspace }}/sensei-lms/ | |
retention-days: 7 | |
playground-preview: | |
if: github.event_name == 'pull_request' | |
name: Playground Preview | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Create comment with Playground preview | |
uses: peter-evans/create-or-update-comment@v4 | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
body: | | |
Test the previous changes of this PR with [WordPress Playground](https://playground.wordpress.net/#{"landingPage":"/wp-admin/admin.php?page=sensei","phpExtensionBundles":["kitchen-sink"],"steps":[{"step":"setSiteOptions","options":{"site_intent":"sensei"}},{"step":"login","username":"admin","password":"password"},{"step":"installPlugin","pluginZipFile":{"resource":"url","url":"https://playground.wordpress.net/plugin-proxy.php?org=Automattic&repo=sensei&workflow=Plugin%20Build&artifact=sensei-lms-${{ github.event.pull_request.head.sha }}&pr=${{ github.event.pull_request.number }}"}},{"step":"installTheme","themeZipFile":{"resource":"wordpress.org\/themes","slug":"course"}}]}). | |
syntax-check: | |
name: PHP Syntax Check | |
needs: build | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
php: [7.4, 8.2] | |
steps: | |
- name: Download Build Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: sensei-lms-${{ github.event.pull_request.head.sha }} | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
tools: phplint | |
coverage: none | |
- name: Check Syntax | |
run: phplint ./sensei-lms |