Continuous Integration #350
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: 'Continuous Integration' | |
on: | |
create: | |
pull_request: | |
push: | |
branches: | |
- "*.x" | |
tags: | |
- "**" | |
jobs: | |
coding-standards: | |
name: "Coding Standards" | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php-version: | |
- 8.2 | |
steps: | |
- name: "Checkout" | |
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4 | |
- name: "Install PHP with extensions" | |
uses: shivammathur/setup-php@2.30.4 | |
with: | |
coverage: none | |
extensions: "mbstring, json, mongo" | |
php-version: ${{ matrix.php-version }} | |
- name: "Validate composer.json and composer.lock" | |
run: composer validate --strict | |
- name: "Cache dependencies installed with composer" | |
uses: actions/cache@v4 | |
with: | |
path: ~/.composer/cache | |
key: php${{ matrix.php-version }}-composer- | |
restore-keys: | | |
php${{ matrix.php-version }}-composer- | |
- name: "Install locked dependencies with composer" | |
run: composer install --no-interaction --no-progress --no-suggest | |
- name: "Run localheinz/composer-normalize" | |
run: composer normalize --dry-run | |
merge: | |
name: "Merge" | |
runs-on: "ubuntu-latest" | |
needs: | |
- "coding-standards" | |
if: > | |
github.event_name == 'pull_request' && | |
github.event.pull_request.draft == false && | |
contains(github.event.pull_request.labels.*.name, 'automerge') | |
steps: | |
- name: "Request review from @nucleos-bot" | |
uses: "actions/github-script@v7" | |
with: | |
github-token: "${{ secrets.NUCLEOS_BOT_TOKEN }}" | |
script: | | |
const pullRequest = context.payload.pull_request | |
const repository = context.repo | |
const reviewers = [ | |
"nucleos-bot", | |
] | |
await github.pulls.requestReviewers({ | |
owner: repository.owner, | |
pull_number: pullRequest.number, | |
repo: repository.repo, | |
reviewers: reviewers, | |
}) | |
- name: "Assign @nucleos-bot" | |
uses: "actions/github-script@v7" | |
with: | |
github-token: "${{ secrets.NUCLEOS_BOT_TOKEN }}" | |
script: | | |
const pullRequest = context.payload.pull_request | |
const repository = context.repo | |
const reviewers = [ | |
"nucleos-bot", | |
] | |
await github.issues.addAssignees({ | |
assignees: reviewers, | |
issue_number: pullRequest.number, | |
owner: repository.owner, | |
repo: repository.repo, | |
}) | |
- name: "Approve pull request" | |
uses: "actions/github-script@v7" | |
if: "github.actor != 'nucleos-bot'" | |
with: | |
github-token: "${{ secrets.NUCLEOS_BOT_TOKEN }}" | |
script: | | |
const pullRequest = context.payload.pull_request | |
const repository = context.repo | |
await github.pulls.createReview({ | |
event: "APPROVE", | |
owner: repository.owner, | |
pull_number: pullRequest.number, | |
repo: repository.repo, | |
}) | |
- name: "Merge pull request" | |
uses: "actions/github-script@v7" | |
with: | |
github-token: "${{ secrets.NUCLEOS_BOT_TOKEN }}" | |
script: | | |
const pullRequest = context.payload.pull_request | |
const repository = context.repo | |
await github.pulls.merge({ | |
merge_method: "merge", | |
owner: repository.owner, | |
pull_number: pullRequest.number, | |
repo: repository.repo, | |
}) |