Skip to content

Commit 683ece7

Browse files
committed
remove issue_comment trriger
1 parent c9b2319 commit 683ece7

File tree

3 files changed

+24
-46
lines changed

3 files changed

+24
-46
lines changed

.github/workflows/pr-deploy.yaml

Lines changed: 12 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
# This action will trigger when
2-
# 1. A PR is commented on with `/deploy-pr`
3-
# 2. when the workflow is manually triggered
4-
# 3. ./scripts/deploy_pr.sh is run locally
5-
# 4. when a PR is updated
2+
# 1. when the workflow is manually triggered
3+
# 2. ./scripts/deploy_pr.sh is run locally
4+
# 3. when a PR is updated
65
name: Deploy PR
76
on:
8-
issue_comment:
9-
types: created
107
pull_request:
118
types: synchronize
129
workflow_dispatch:
@@ -35,12 +32,12 @@ permissions:
3532
pull-requests: write
3633

3734
concurrency:
38-
group: ${{ github.workflow }}-PR-${{ github.event.pull_request.number || github.event.issue.number || github.event.inputs.pr_number }}
35+
group: ${{ github.workflow }}-PR-${{ github.event.pull_request.number || github.event.inputs.pr_number }}
3936
cancel-in-progress: true
4037

4138
jobs:
4239
get_info:
43-
if: (github.event_name == 'issue_comment' && contains(github.event.comment.body, '/deploy-pr') && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'COLLABORATOR' || github.event.comment.author_association == 'OWNER')) || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request'
40+
if: github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request'
4441
outputs:
4542
PR_NUMBER: ${{ steps.pr_info.outputs.PR_NUMBER }}
4643
PR_TITLE: ${{ steps.pr_info.outputs.PR_TITLE }}
@@ -57,7 +54,7 @@ jobs:
5754
id: pr_info
5855
run: |
5956
set -euxo pipefail
60-
PR_NUMBER=${{ github.event.inputs.pr_number || github.event.pull_request.number || github.event.issue.number }}
57+
PR_NUMBER=${{ github.event.inputs.pr_number || github.event.pull_request.number }}
6158
PR_TITLE=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/coder/coder/pulls/$PR_NUMBER | jq -r '.title')
6259
PR_BRANCH=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/coder/coder/pulls/$PR_NUMBER | jq -r '.head.ref')
6360
echo "PR_URL=https://github.com/coder/coder/pull/$PR_NUMBER" >> $GITHUB_OUTPUT
@@ -97,7 +94,6 @@ jobs:
9794
9895
- name: Comment on PR
9996
id: comment_id
100-
if: github.event_name == 'issue_comment'
10197
uses: peter-evans/create-or-update-comment@v3
10298
with:
10399
issue-number: ${{ steps.pr_info.outputs.PR_NUMBER }}
@@ -148,7 +144,6 @@ jobs:
148144
# alwyas run the build job if the workflow was triggered by a pull_request event
149145
if: |
150146
(github.event_name == 'workflow_dispatch' && github.event.inputs.skip_build == 'false') ||
151-
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '--skip-build') == false) ||
152147
(github.event_name == 'pull_request' && needs.get_info.outputs.NEW == 'false')
153148
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
154149
env:
@@ -299,29 +294,17 @@ jobs:
299294
--from-literal=url="postgres://coder:coder@coder-db-postgresql.pr${{ env.PR_NUMBER }}.svc.cluster.local:5432/coder?sslmode=disable"
300295
301296
- name: Get experiments
302-
if: needs.get_info.outputs.NEW == 'true'
303297
id: get_experiments
304298
run: |
305299
set -euxo pipefail
306300
if [[ ${{ github.event_name }} == "workflow_dispatch" ]]; then
307301
experiments=${{ github.event.inputs.experiments }}
308302
else
309-
# extract experiments part
310-
extracted_experiments=$(echo "$COMMENT_BODY" | grep -oP '(?<=--experiments )[^ ]+')
311-
# Validate that the experiments is a comma-separated list of alphanumeric strings, "*", or "-"
312-
if [[ $extracted_experiments =~ ^[a-zA-Z0-9_*,\"-]+$ ]]; then
313-
experiments=$extracted_experiments
314-
else
315-
echo "Invalid input: $extracted_experiments"
316-
exit 1
317-
fi
303+
experiments='*' # enable all experiments by default
318304
fi
319305
echo "experiments=$experiments" >> $GITHUB_OUTPUT
320-
env:
321-
COMMENT_BODY: ${{ github.event.comment.body || '' }}
322306
323307
- name: Create values.yaml
324-
if: needs.get_info.outputs.NEW == 'true'
325308
run: |
326309
cat <<EOF > pr-deploy-values.yaml
327310
coder:
@@ -346,7 +329,7 @@ jobs:
346329
- name: "CODER_WILDCARD_ACCESS_URL"
347330
value: "*.${{ env.PR_DEPLOYMENT_ACCESS_URL }}"
348331
- name: "CODER_EXPERIMENTS"
349-
value: "*,${{ steps.get_experiments.outputs.experiments }}"
332+
value: "${{ steps.get_experiments.outputs.experiments }}"
350333
- name: CODER_PG_CONNECTION_URL
351334
valueFrom:
352335
secretKeyRef:
@@ -365,18 +348,10 @@ jobs:
365348
- name: Install Helm chart
366349
run: |
367350
set -euxo pipefail
368-
# if the deployment already exists, we need to upgrade it by resuing the existing values
369-
if [[ ${{ needs.get_info.outputs.NEW }} == "false" ]]; then
370-
helm upgrade --install "pr${{ env.PR_NUMBER }}" ./helm \
371-
--namespace "pr${{ env.PR_NUMBER }}" \
372-
--reuse-values \
373-
--force
374-
else
375-
helm upgrade --install "pr${{ env.PR_NUMBER }}" ./helm \
376-
--namespace "pr${{ env.PR_NUMBER }}" \
377-
--values ./pr-deploy-values.yaml \
378-
--force
379-
fi
351+
helm upgrade --install "pr${{ env.PR_NUMBER }}" ./helm \
352+
--namespace "pr${{ env.PR_NUMBER }}" \
353+
--values ./pr-deploy-values.yaml \
354+
--force
380355
381356
- name: Install coder-logstream-kube
382357
if: needs.get_info.outputs.NEW == 'true'

docs/CONTRIBUTING.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,18 @@ Use the following `make` commands and scripts in development:
8383

8484
You can test your changes by creating a PR deployment. A PR deployment can be triggered in two ways:
8585

86-
1. By commenting on the PR with `/deploy-pr`
87-
2. By running `./scripts/deploy-pr.sh`
88-
3. Available options
89-
- `-s` or `--skip-build`, the image will not be built again, and the last image will be used.
90-
- `-e EXPERIMENT1,EXPERIMENT2` or `--experiments EXPERIMENT1,EXPERIMENT2`, will enable the specified experiments.
91-
- `-n` or `--dry-run` will display the context without deployment. e.g., branch name and PR number, etc.
92-
- `-y` or `--yes`, will skip the CLI confirmation (only valid for the `./scripts/deploy-pr.sh`)
93-
94-
> Note: all flags can be used with both `./scripts/deploy-pr.sh` and `/deploy-pr` comment on the PR.
86+
1. By running `./scripts/deploy-pr.sh`
87+
2. By manually triggering the [`pr-deploy.yaml`](https://github.com/coder/coder/actions/workflows/pr-deploy.yaml) GitHub Action workflow
88+
![Deploy PR manually](./images/pr-deploy-manual.png)
89+
90+
#### Available options
91+
92+
- `-s` or `--skip-build`, the image will not be built again, and the last image will be used.
93+
- `-e EXPERIMENT1,EXPERIMENT2` or `--experiments EXPERIMENT1,EXPERIMENT2`, will enable the specified experiments.
94+
- `-n` or `--dry-run` will display the context without deployment. e.g., branch name and PR number, etc.
95+
- `-y` or `--yes`, will skip the CLI confirmation (only valid for the `./scripts/deploy-pr.sh`)
96+
97+
> Note: PR deployment will be re-deployed automatically when the PR is updated.
9598
9699
> You need to be a member or collaborator of the of [coder](github.com/coder) GitHub organization to be able to deploy a PR.
97100

docs/images/pr-deploy-manual.png

26.5 KB
Loading

0 commit comments

Comments
 (0)