Skip to content

Commit

Permalink
workflows: Add manual run and restrict by usernames
Browse files Browse the repository at this point in the history
As seems restriction by team doesnt work, use allowed username list (temporary, to be improved).
Additionally, make option to run workflow manually.

Signed-off-by: Denys Fedoryshchenko <[email protected]>
  • Loading branch information
nuclearcat committed May 17, 2024
1 parent d0eb806 commit d898ced
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,40 @@
name: Hugo Staging Deploy

on:
# pull_request:
# types: [review_requested]
issue_comment:
types: [created, edited]
workflow_dispatch:
inputs:
environment:
description: 'Environment to deploy to'
required: true
default: 'staging'


jobs:
deploy_staging:
if: ${{ github.event.issue.pull_request && github.event.requested_team.name == 'hackers' && contains(github.event.comment.body, '/staging') }}
if: |
${{ github.event.issue.pull_request && contains('["nuclearcat","JenySadadia","a-wai","broonie","laura-nao"]', github.actor) && contains(github.event.comment.body, '/staging') }} ||
${{ github.event_name == 'workflow_dispatch' && contains('["nuclearcat","JenySadadia","a-wai","broonie","laura-nao"]', github.actor) }}
runs-on: ubuntu-22.04
environment: stagingdeploy
steps:
- name: Checkout PR branch
uses: actions/checkout@v4
if: github.event_name == 'issue_comment'
with:
submodules: recursive # Fetch Hugo themes (true OR recursive)
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
lfs: true # Fetch Git LFS files
ref: refs/pull/${{ github.event.issue.number }}/head

- name: Checkout main branch
uses: actions/checkout@v4
if: github.event_name == 'workflow_dispatch'
with:
submodules: recursive # Fetch Hugo themes (true OR recursive)
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
lfs: true # Fetch Git LFS files
ref: main
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
Expand Down

0 comments on commit d898ced

Please sign in to comment.