-
Notifications
You must be signed in to change notification settings - Fork 91
27 lines (27 loc) · 1.12 KB
/
trigger-deploy-on-comment.yml
File metadata and controls
27 lines (27 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
name: Trigger deploy on comment
on:
issue_comment:
types: [created]
permissions: read-all
jobs:
if_merged:
if: github.event.issue.pull_request && contains(github.event.comment.body, '/deploy')
runs-on: ubuntu-latest
steps:
- name: User has permission to deploy
uses: actions/github-script@v6
with:
script: |
// Check if the user trying to deploy is an authorized user
const creator = context.payload.sender.login
const authorizedHandles = ["mvkaran", "andreagriffiths11", "pachicodes", "abhinavrajesh"]
if(!authorizedHandles.includes(creator.toLowerCase())) {
core.setFailed("User not authorized to deploy")
}
- name: Trigger build
uses: benc-uk/workflow-dispatch@e2e5e9a103e331dad343f381a29e654aea3cf8fc #v1.2.4
with:
repo: ${{ secrets.GITHUBBRASIL_REPO_NWO }}
workflow: Trigger build when public PR is merged
token: ${{ secrets.PAT }}
inputs: '{"pr_number": "${{ github.event.issue.number }}", "creator_username": "${{ github.event.issue.user.login }}" }'