Close Related PAN.DEV PR - (#123) feat(ansible_ee): introduce Ansible Execution Environment image build #31
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: Close PR | |
run-name: "Close Related PAN.DEV PR - (#${{ github.event.number }}) ${{ github.event.pull_request.title }}" | |
defaults: | |
run: | |
shell: bash | |
permissions: | |
contents: read | |
on: | |
pull_request: | |
branches: ['main'] | |
types: ['closed'] | |
jobs: | |
close: | |
name: Close PAN.DEV preview PR | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- uses: actions/github-script@v6 | |
with: | |
result-encoding: string | |
github-token: ${{ secrets.CLSC_PAT }} | |
script: | | |
let prs = await github.rest.pulls.list({ | |
owner: "PaloAltoNetworks", | |
repo: "pan.dev", | |
state: "open", | |
}) | |
let prs_list = prs.data | |
for (let pr of prs_list){ | |
if (pr.head.label == "PaloAltoNetworks:pua_prev_${{ github.event.pull_request.head.ref }}"){ | |
await github.rest.pulls.update({ | |
owner: "PaloAltoNetworks", | |
repo: "pan.dev", | |
pull_number: pr.number, | |
state: "closed", | |
}) | |
console.log("Closing related PAN.DEV PR: #" + pr.number + " - " + pr.title + " -> " + pr.url) | |
break | |
} | |
} |