Skip to content

Commit

Permalink
ci: trigger CI via comment and label (#11849)
Browse files Browse the repository at this point in the history
* ci: trigger CI via comment and label

* fix: reduce parenthesis
  • Loading branch information
ematipico authored Aug 27, 2024
1 parent 0a92f1a commit 543e8f5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 8 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/preview-comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Add continuous release label

on:
issue_comment:
types: [created]

permissions:
pull-requests: write

jobs:
label:
if: ${{ github.repository_owner == 'withastro' && startsWith(github.event.comment.body, '!preview') }}
runs-on: ubuntu-latest

steps:
- run: |
gh issue edit ${{ github.event.issue.number }} --add-label "pr: preview" --repo ${{ github.repository }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17 changes: 9 additions & 8 deletions .github/workflows/preview-release.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
name: Preview release

on:
workflow_dispatch:
issue_comment:
types: [created]
pull_request:
branches: [main]
types: [opened, synchronize, labeled, ready_for_review]

concurrency:
group: ${{ github.workflow }}-${{ github.event.number }}
cancel-in-progress: true

permissions:
contents: read
actions: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
Expand All @@ -24,7 +24,8 @@ env:

jobs:
preview:
if: ${{ github.repository_owner == 'withastro' && github.event.issue.pull_request && (startsWith(github.event.comment.body, '!preview')) }}
if: |
${{ github.repository_owner == 'withastro' && github.event.issue.pull_request && contains(github.event.pull_request.labels.*.name, 'pr: preview') }}
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down

0 comments on commit 543e8f5

Please sign in to comment.