Skip to content

automerge-run

automerge-run #15212

Workflow file for this run

name: automerge-run
on:
workflow_run:
workflows:
- automerge
types:
- completed
jobs:
automerge-run:
runs-on: ubuntu-latest
if: >
github.event.workflow_run.event == 'pull_request_review' &&
github.event.workflow_run.conclusion == 'success'
steps:
- name: Event
run: |
echo "${EVENT_NAME}"
echo "${EVENT_JSON}"
env:
EVENT_NAME: ${{ github.event_name }}
EVENT_JSON: ${{ toJSON(github.event) }}
- name: Download `event.json`
id: download_event_json
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
with:
script: |
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
...context.repo,
run_id: ${{ github.event.workflow_run.id }},
})
const matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "event.json"
})[0]
const download = await github.rest.actions.downloadArtifact({
...context.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
const fs = require('fs')
fs.writeFileSync('${{ github.workspace }}/artifact.zip', Buffer.from(download.data))
if: >
github.event.workflow_run.event == 'pull_request_review' &&
github.event.workflow_run.conclusion == 'success'
- name: Extract `event.json`
id: review_info
run: |
unzip artifact.zip
echo "pull_request=$(jq -r .pull_request.number event.json)" >> "${GITHUB_OUTPUT}"
echo "review=$(jq -r .review.id event.json)" >> "${GITHUB_OUTPUT}"
if: steps.download_event_json.outcome == 'success'
- name: Trigger workflow for review ${{ steps.review_info.outputs.review }} on pull request \#${{ steps.review_info.outputs.pull_request }}
uses: benc-uk/workflow-dispatch@e2e5e9a103e331dad343f381a29e654aea3cf8fc
with:
workflow: automerge.yml
inputs: >
{
"pull-request": "${{ steps.review_info.outputs.pull_request }}",
"review": "${{ steps.review_info.outputs.review }}"
}
if: >
steps.review_info.outputs.pull_request &&
steps.review_info.outputs.review