-
Notifications
You must be signed in to change notification settings - Fork 412
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1098 from AbhinavRajesh/main
chore: Updated the workflow flow for the deployment of the githubindia website
- Loading branch information
Showing
2 changed files
with
26 additions
and
19 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Trigger deploy on comment | ||
on: | ||
issue_comment: | ||
types: [created] | ||
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", "abhinavrajesh"] | ||
if(!authorizedHandles.includes(creator.toLowerCase())) { | ||
core.setFailed("User not authorized to deploy") | ||
} | ||
- name: Trigger build | ||
uses: benc-uk/workflow-dispatch@v1 | ||
with: | ||
repo: ${{ secrets.GITHUBINDIA_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 }}" }' |