Ensure Fork PR Build Pack Only Runs on Approved (#570)

[SKIP]
This commit is contained in:
Integer Limit 2023-12-09 23:42:28 +11:00 committed by GitHub
parent 761718e1ad
commit e55bbef504
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,11 +18,12 @@ permissions:
contents: read contents: read
jobs: jobs:
makeNames: setup:
# Only continue if we are in base Nomi-CEu Repo and pull request is from fork # Only continue if we are in base Nomi-CEu Repo and pull request is from fork
if: "${{ github.repository_owner == 'Nomi-CEu' && github.event.pull_request.head.repo.owner.login != 'Nomi-CEu' }}" if: "${{ github.repository_owner == 'Nomi-CEu' && github.event.pull_request.head.repo.owner.login != 'Nomi-CEu' }}"
name: Make Fork PR Artifact Names (${{ github.event.pull_request.head.sha }}) name: Setup (${{ github.event.pull_request.head.sha }})
runs-on: ubuntu-latest runs-on: ubuntu-latest
environment: fork-pr-build-pack
env: env:
GITHUB_HEAD_REF: ${{ github.head_ref }} GITHUB_HEAD_REF: ${{ github.head_ref }}
TRUE_SHA: ${{ github.event.pull_request.head.sha }} TRUE_SHA: ${{ github.event.pull_request.head.sha }}
@ -31,6 +32,7 @@ jobs:
server: ${{ steps.artifactNames.outputs.server }} server: ${{ steps.artifactNames.outputs.server }}
lang: ${{ steps.artifactNames.outputs.lang }} lang: ${{ steps.artifactNames.outputs.lang }}
mmc: ${{ steps.artifactNames.outputs.mmc }} mmc: ${{ steps.artifactNames.outputs.mmc }}
cf_token: ${{ secrets.CFCORE_API_TOKEN }}
steps: steps:
- name: Checkout Ref - name: Checkout Ref
uses: actions/checkout@v4 uses: actions/checkout@v4
@ -61,8 +63,7 @@ jobs:
if: "${{ github.repository_owner == 'Nomi-CEu' && github.event.pull_request.head.repo.owner.login != 'Nomi-CEu' }}" if: "${{ github.repository_owner == 'Nomi-CEu' && github.event.pull_request.head.repo.owner.login != 'Nomi-CEu' }}"
name: Build Fork PR Client (${{ github.event.pull_request.head.sha }}) name: Build Fork PR Client (${{ github.event.pull_request.head.sha }})
runs-on: ubuntu-latest runs-on: ubuntu-latest
environment: fork-pr-build-pack needs: setup
needs: makeNames
env: env:
GITHUB_HEAD_REF: ${{ github.head_ref }} GITHUB_HEAD_REF: ${{ github.head_ref }}
TRUE_SHA: ${{ github.event.pull_request.head.sha }} TRUE_SHA: ${{ github.event.pull_request.head.sha }}
@ -90,12 +91,12 @@ jobs:
working-directory: ./tools working-directory: ./tools
run: npx gulp buildClient run: npx gulp buildClient
env: env:
CFCORE_API_TOKEN: ${{ secrets.CFCORE_API_TOKEN }} CFCORE_API_TOKEN: ${{ needs.setup.outputs.cf_token }}
- name: Upload Client Zip - name: Upload Client Zip
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: ${{ needs.makeNames.outputs.client }} name: ${{ needs.setup.outputs.client }}
path: ./build/client/**/* path: ./build/client/**/*
if-no-files-found: error if-no-files-found: error
@ -105,7 +106,7 @@ jobs:
name: Build Fork PR Server (${{ github.event.pull_request.head.sha }}) name: Build Fork PR Server (${{ github.event.pull_request.head.sha }})
runs-on: ubuntu-latest runs-on: ubuntu-latest
environment: fork-pr-build-pack environment: fork-pr-build-pack
needs: makeNames needs: setup
env: env:
GITHUB_HEAD_REF: ${{ github.head_ref }} GITHUB_HEAD_REF: ${{ github.head_ref }}
TRUE_SHA: ${{ github.event.pull_request.head.sha }} TRUE_SHA: ${{ github.event.pull_request.head.sha }}
@ -133,12 +134,12 @@ jobs:
working-directory: ./tools working-directory: ./tools
run: npx gulp buildServer run: npx gulp buildServer
env: env:
CFCORE_API_TOKEN: ${{ secrets.CFCORE_API_TOKEN }} CFCORE_API_TOKEN: ${{ needs.setup.outputs.cf_token }}
- name: Upload Server Zip - name: Upload Server Zip
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: ${{ needs.makeNames.outputs.server }} name: ${{ needs.setup.outputs.server }}
path: ./build/server/**/* path: ./build/server/**/*
if-no-files-found: error if-no-files-found: error
@ -148,7 +149,7 @@ jobs:
name: Build Fork PR Lang and Changelogs (${{ github.event.pull_request.head.sha }}) name: Build Fork PR Lang and Changelogs (${{ github.event.pull_request.head.sha }})
runs-on: ubuntu-latest runs-on: ubuntu-latest
environment: fork-pr-build-pack environment: fork-pr-build-pack
needs: makeNames needs: setup
env: env:
GITHUB_HEAD_REF: ${{ github.head_ref }} GITHUB_HEAD_REF: ${{ github.head_ref }}
TRUE_SHA: ${{ github.event.pull_request.head.sha }} TRUE_SHA: ${{ github.event.pull_request.head.sha }}
@ -176,12 +177,12 @@ jobs:
working-directory: ./tools working-directory: ./tools
run: npx gulp buildLang run: npx gulp buildLang
env: env:
CFCORE_API_TOKEN: ${{ secrets.CFCORE_API_TOKEN }} CFCORE_API_TOKEN: ${{ needs.setup.outputs.cf_token }}
- name: Upload Lang Zip - name: Upload Lang Zip
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: ${{ needs.makeNames.outputs.lang }} name: ${{ needs.setup.outputs.lang }}
path: ./build/lang/**/* path: ./build/lang/**/*
if-no-files-found: error if-no-files-found: error