-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
20 additions
and
38 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,52 +25,17 @@ jobs: | |
check-intent: | ||
name: Check release trigger | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
php-version: [8.2] | ||
|
||
outputs: | ||
valid: ${{ steps.validate.outputs.DEV_BUILD == 'false' | ||
&& steps.check-permission.outputs.require-result == 'true' | ||
&& steps.check-permission.outputs.check-result == 'false' | ||
}} | ||
valid: ${{ steps.validate.outputs.DEV_BUILD == 'false' }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/[email protected] | ||
with: | ||
php-version: ${{ matrix.php-version }} | ||
|
||
- name: Restore Composer package cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.cache/composer/files | ||
~/.cache/composer/vcs | ||
key: "composer-v2-cache-${{ hashFiles('./composer.lock') }}" | ||
restore-keys: | | ||
composer-v2-cache- | ||
- name: Install Composer dependencies | ||
run: composer install --no-dev --prefer-dist --no-interaction --ignore-platform-reqs | ||
|
||
- name: Check if PR author has write access | ||
id: check-permission | ||
uses: actions-cool/check-user-permission@v2 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
require: write | ||
username: ${{ github.event.pull_request.user.login }} | ||
#technically this would be fine for dependabot but generally bots don't count as team members | ||
check-bot: true | ||
|
||
- name: Check IS_DEVELOPMENT_BUILD flag | ||
id: validate | ||
run: | | ||
echo DEV_BUILD=$(php build/dump-version-info.php is_dev) >> $GITHUB_OUTPUT | ||
echo DEV_BUILD=$(sed -n "s/^\s*public const IS_DEVELOPMENT_BUILD = \(true\|false\);$/\1/p" src/VersionInfo.php) >> $GITHUB_OUTPUT | ||
check-validity: | ||
name: Validate release info | ||
|
@@ -86,7 +51,7 @@ jobs: | |
- name: Setup PHP | ||
uses: shivammathur/[email protected] | ||
with: | ||
php-version: ${{ matrix.php-version }} | ||
php-version: 8.2 | ||
|
||
- name: Restore Composer package cache | ||
uses: actions/cache@v4 | ||
|
@@ -101,6 +66,23 @@ jobs: | |
- name: Install Composer dependencies | ||
run: composer install --no-dev --prefer-dist --no-interaction --ignore-platform-reqs | ||
|
||
- name: Check author permissions | ||
id: check-permission | ||
uses: actions-cool/check-user-permission@v2 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
require: write | ||
username: ${{ github.event.pull_request.user.login }} | ||
#technically this would be fine for dependabot but generally bots don't count as team members | ||
check-bot: true | ||
|
||
- name: Abort if user permissions are insufficient | ||
if: steps.check-permission.outputs.require-result != 'true' #user doesn't have permission | ||
|| steps.check-permission.outputs.check-result != 'false' #user is a bot | ||
run: | | ||
echo "::error::This user is not authorized to trigger releases" | ||
exit 1 | ||
- name: Check changelog file is present | ||
id: file-presence | ||
run: | | ||
|