Skip to content

Commit cde7f50

Browse files
author
Abhinav Rajesh
authored
Merge pull request github#1098 from AbhinavRajesh/main
chore: Updated the workflow flow for the deployment of the githubindia website
2 parents e0ab1d4 + 35554f5 commit cde7f50

2 files changed

Lines changed: 26 additions & 19 deletions

File tree

.github/workflows/trigger-build.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Trigger deploy on comment
2+
on:
3+
issue_comment:
4+
types: [created]
5+
jobs:
6+
if_merged:
7+
if: github.event.issue.pull_request && contains(github.event.comment.body, '/deploy')
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: User has permission to deploy
11+
uses: actions/github-script@v6
12+
with:
13+
script: |
14+
// Check if the user trying to deploy is an authorized user
15+
const creator = context.payload.sender.login
16+
const authorizedHandles = ["mvkaran", "abhinavrajesh"]
17+
if(!authorizedHandles.includes(creator.toLowerCase())) {
18+
core.setFailed("User not authorized to deploy")
19+
}
20+
- name: Trigger build
21+
uses: benc-uk/workflow-dispatch@v1
22+
with:
23+
repo: ${{ secrets.GITHUBINDIA_REPO_NWO }}
24+
workflow: Trigger build when public PR is merged
25+
token: ${{ secrets.PAT }}
26+
inputs: '{"pr_number": "${{ github.event.issue.number }}", "creator_username": "${{ github.event.issue.user.login }}" }'

0 commit comments

Comments
 (0)