Merge pull request #1098 from AbhinavRajesh/main

chore: Updated the workflow flow for the deployment of the githubindia website
This commit is contained in:
Abhinav Rajesh 2023-05-22 13:26:42 +05:30 коммит произвёл GitHub
Родитель e0ab1d423c 35554f5c8a
Коммит cde7f5010d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 26 добавлений и 19 удалений

19
.github/workflows/trigger-build.yml поставляемый
Просмотреть файл

@ -1,19 +0,0 @@
name: Trigger build
on:
pull_request:
types:
- closed
paths:
- "website/**"
jobs:
if_merged:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Trigger build
uses: benc-uk/workflow-dispatch@v1
with:
workflow: Trigger build when public PR is merged
token: ${{ secrets.PAT }}
repo: ${{ secrets.GITHUBINDIA_REPO_NWO }}
inputs: '{"pr_number": "${{ github.event.number }}", "creator_username": "${{ github.event.pull_request.user.login }}" }'

26
.github/workflows/trigger-deploy-on-comment.yml поставляемый Normal file
Просмотреть файл

@ -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 }}" }'