diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 272998ea..be5028dc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,25 +15,37 @@ jobs: steps: - uses: actions/setup-node@v4 with: - node-version: 16 + node-version: 18 - - name: "install Dependencies" + - name: Install Dependencies run: | sudo apt-get update -qq sudo apt-get install libxml2-utils npm install -g pkp-plugin-cli shell: bash + - name: Clone pkp plugin gallery + run: | + cd ~/${{github.event.pull_request.head.repo.name || github.event.repository.name }} + git clone -b main https://github.com/pkp/plugin-gallery --depth 50 + shell: bash + - name: Install for push if: ${{ github.event_name == 'push'}} run: | - git clone -b ${{ github.head_ref || github.ref_name }} https://github.com/${{ github.repository}} ~/${{ github.event.repository.name }} --depth 50 + cd ~/${{github.event.pull_request.head.repo.name || github.event.repository.name }} + git remote add user_repo https://github.com/${{ github.repository}} + git fetch user_repo ${{ github.head_ref || github.ref_name }} + git checkout -b user_repo/ ${{ github.head_ref || github.ref_name }} shell: bash - name: Install for pull_request if: ${{github.event_name == 'pull_request'}} run: | - git clone -b ${{ github.event.pull_request.head.ref}} ${{ github.event.pull_request.head.repo.html_url}} ~/${{ github.event.pull_request.head.repo.name }} --depth 50 + cd ~/${{github.event.pull_request.head.repo.name || github.event.repository.name }} + git remote add user_repo https://github.com/${{ github.event.pull_request.head.repo.name }} + git fetch user_repo ${{ github.event.pull_request.head.ref}} ${{ github.event.pull_request.head.repo.html_url}} + git checkout -b user_repo/${{ github.event.pull_request.head.ref}} ${{ github.event.pull_request.head.repo.html_url}} shell: bash - name: "Run plugin validation" @@ -49,7 +61,7 @@ jobs: pkp-plugin validate-all-releases --input ./plugins.xml shell: bash - - name: For pull request + - name: For pull request validate-new-release if: ${{ github.event_name == 'pull_request'}} run: | cd ~/${{github.event.pull_request.head.repo.name || github.event.repository.name }} @@ -57,12 +69,9 @@ jobs: pkp-plugin validate-new-release shell: bash - - name: For push + - name: For push generate-site if: ${{ github.event_name == 'push' && github.head_ref == 'main'}} run: | cd ~/${{github.event.pull_request.head.repo.name || github.event.repository.name }} GITHUB_TOKEN=${{secrets.GITHUB_TOKEN}} pkp-plugin generate-site ./plugins.xml shell: bash - - name: Setup tmate session by failure - if: ${{ failure() }} - uses: mxschmitt/action-tmate@v3 \ No newline at end of file