2021-04-15 15:16:00 +00:00
|
|
|
name: "Pull request post-merge processing"
|
2021-07-29 14:47:27 +00:00
|
|
|
on:
|
|
|
|
pull_request_target:
|
2021-04-15 15:16:00 +00:00
|
|
|
types: [closed]
|
|
|
|
|
|
|
|
jobs:
|
2021-08-03 08:07:24 +00:00
|
|
|
process-pull-request-after-merge:
|
|
|
|
name: "Process a pull request after it's merged"
|
|
|
|
if: github.event.pull_request.merged == true
|
2021-04-15 15:16:00 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2021-08-03 09:33:33 +00:00
|
|
|
- name: "Get the action scripts"
|
2021-08-03 08:07:24 +00:00
|
|
|
run: |
|
2021-08-03 09:33:33 +00:00
|
|
|
scripts="assign-milestone-to-merged-pr.php add-post-merge-comment.php post-request-shared.php"
|
2021-08-03 08:07:24 +00:00
|
|
|
for script in $scripts
|
|
|
|
do
|
|
|
|
curl \
|
|
|
|
--silent \
|
|
|
|
--fail \
|
|
|
|
--header 'Authorization: bearer ${{ secrets.GITHUB_TOKEN }}' \
|
|
|
|
--header 'User-Agent: GitHub action to set the milestone for a pull request' \
|
|
|
|
--header 'Accept: application/vnd.github.v3.raw' \
|
|
|
|
--output $script \
|
|
|
|
--location "$GITHUB_API_URL/repos/${{ github.repository }}/contents/.github/workflows/scripts/$script?ref=${{ github.event.pull_request.base.ref }}"
|
|
|
|
done
|
|
|
|
env:
|
|
|
|
GITHUB_API_URL: ${{ env.GITHUB_API_URL }}
|
|
|
|
- name: "Install PHP"
|
|
|
|
uses: shivammathur/setup-php@v2
|
|
|
|
with:
|
|
|
|
php-version: '7.4'
|
|
|
|
- name: "Run the script to assign a milestone"
|
2022-03-31 13:41:18 +00:00
|
|
|
if: |
|
|
|
|
contains(github.event.pull_request.labels.*.name, 'plugin: woocommerce') &&
|
|
|
|
!github.event.pull_request.milestone &&
|
|
|
|
github.event.pull_request.base.ref == 'trunk'
|
2021-08-03 08:07:24 +00:00
|
|
|
run: php assign-milestone-to-merged-pr.php
|
|
|
|
env:
|
|
|
|
PULL_REQUEST_ID: ${{ github.event.pull_request.node_id }}
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: "Run the script to post a comment with next steps hint"
|
2022-02-22 18:04:33 +00:00
|
|
|
if: "contains(github.event.pull_request.labels.*.name, 'plugin: woocommerce')"
|
2021-08-03 08:07:24 +00:00
|
|
|
run: php add-post-merge-comment.php
|
|
|
|
env:
|
|
|
|
PULL_REQUEST_ID: ${{ github.event.pull_request.node_id }}
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|