mirror of
https://github.com/coder/coder.git
synced 2026-06-02 20:48:20 +00:00
fix: revert back to curl in deply-pr.yaml (#8729)
This commit is contained in:
committed by
GitHub
parent
733ae5038a
commit
0feb855b8f
@@ -25,32 +25,30 @@ jobs:
|
||||
pr_commented:
|
||||
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'
|
||||
outputs:
|
||||
PR_NUMBER: ${{ steps.pr_number.outputs.PR_NUMBER }}
|
||||
PR_TITLE: ${{ steps.pr_number.outputs.PR_TITLE }}
|
||||
PR_URL: ${{ steps.pr_number.outputs.PR_URL }}
|
||||
PR_BRANCH: ${{ steps.pr_number.outputs.PR_BRANCH }}
|
||||
PR_NUMBER: ${{ steps.pr_info.outputs.PR_NUMBER }}
|
||||
PR_TITLE: ${{ steps.pr_info.outputs.PR_TITLE }}
|
||||
PR_URL: ${{ steps.pr_info.outputs.PR_URL }}
|
||||
PR_BRANCH: ${{ steps.pr_info.outputs.PR_BRANCH }}
|
||||
CODER_BASE_IMAGE_TAG: ${{ steps.set_tags.outputs.CODER_BASE_IMAGE_TAG }}
|
||||
CODER_IMAGE_TAG: ${{ steps.set_tags.outputs.CODER_IMAGE_TAG }}
|
||||
|
||||
runs-on: "ubuntu-latest"
|
||||
steps:
|
||||
- name: Get PR number, title, and branch name
|
||||
id: pr_number
|
||||
id: pr_info
|
||||
run: |
|
||||
set -e pipefail
|
||||
if [[ ${{ github.event_name }} == 'workflow_dispatch' ]]; then
|
||||
set -euxo pipefail
|
||||
if [[ ${{ github.event_name }} == "workflow_dispatch" ]]; then
|
||||
PR_NUMBER=${{ github.event.inputs.pr_number }}"
|
||||
else
|
||||
PR_NUMBER=${{ github.event.issue.number }}"
|
||||
fi
|
||||
PR_TITLE=$(gh pr view $PR_NUMBER --json title | jq -r '.title')
|
||||
PR_BRANCH=$(gh pr view $PR_NUMBER --json headRefName | jq -r '.headRefName')
|
||||
PR_TITLE=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/coder/coder/pulls/$PR_NUMBER | jq -r '.title')
|
||||
PR_BRANCH=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/coder/coder/pulls/$PR_NUMBER | jq -r '.head.ref')
|
||||
echo "PR_URL=https://github.com/coder/coder/pull/$PR_NUMBER" >> $GITHUB_OUTPUT
|
||||
echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_OUTPUT
|
||||
echo "PR_TITLE=$PR_TITLE" >> $GITHUB_OUTPUT
|
||||
echo "PR_BRANCH=$PR_BRANCH" >> $GITHUB_OUTPUT
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Set required tags
|
||||
id: set_tags
|
||||
@@ -59,27 +57,27 @@ jobs:
|
||||
echo "CODER_BASE_IMAGE_TAG=$CODER_BASE_IMAGE_TAG" >> $GITHUB_OUTPUT
|
||||
echo "CODER_IMAGE_TAG=$CODER_IMAGE_TAG" >> $GITHUB_OUTPUT
|
||||
env:
|
||||
CODER_BASE_IMAGE_TAG: ghcr.io/coder/coder-preview-base:pr${{ steps.pr_number.outputs.PR_NUMBER }}
|
||||
CODER_IMAGE_TAG: ghcr.io/coder/coder-preview:pr${{ steps.pr_number.outputs.PR_NUMBER }}
|
||||
CODER_BASE_IMAGE_TAG: ghcr.io/coder/coder-preview-base:pr${{ steps.pr_info.outputs.PR_NUMBER }}
|
||||
CODER_IMAGE_TAG: ghcr.io/coder/coder-preview:pr${{ steps.pr_info.outputs.PR_NUMBER }}
|
||||
|
||||
- name: Comment on PR
|
||||
id: comment_id
|
||||
uses: peter-evans/create-or-update-comment@v3
|
||||
with:
|
||||
issue-number: ${{ steps.pr_number.outputs.PR_NUMBER }}
|
||||
issue-number: ${{ steps.pr_info.outputs.PR_NUMBER }}
|
||||
body: |
|
||||
:rocket: Deploying PR ${{ steps.pr_number.outputs.PR_NUMBER }} ...
|
||||
:rocket: Deploying PR ${{ steps.pr_info.outputs.PR_NUMBER }} ...
|
||||
:warning: This deployment will be deleted when the PR is closed.
|
||||
reactions: "-1"
|
||||
reactions: "+1"
|
||||
|
||||
build:
|
||||
needs: pr_commented
|
||||
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
|
||||
env:
|
||||
DOCKER_CLI_EXPERIMENTAL: "enabled"
|
||||
CODER_IMAGE_TAG: ${{ needs.pr_commented.outputs.coder_image_tag }}
|
||||
PR_NUMBER: ${{ needs.pr_commented.outputs.pr_number }}
|
||||
PR_BRANCH: ${{ needs.pr_commented.outputs.pr_branch }}
|
||||
CODER_IMAGE_TAG: ${{ needs.pr_commented.outputs.CODER_IMAGE_TAG }}
|
||||
PR_NUMBER: ${{ needs.pr_commented.outputs.PR_NUMBER }}
|
||||
PR_BRANCH: ${{ needs.pr_commented.outputs.PR_BRANCH }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
@@ -239,10 +237,7 @@ jobs:
|
||||
:heavy_check_mark: Deployed PR ${{ env.PR_NUMBER }} successfully.
|
||||
:rocket: Access the deployment link [here](${{ env.PR_DEPLOYMENT_ACCESS_URL }}).
|
||||
:warning: This deployment will be deleted when the PR is closed.
|
||||
reactions: |
|
||||
+1
|
||||
rocket
|
||||
reactions-edit-mode: replace
|
||||
reactions: rocket
|
||||
|
||||
env:
|
||||
PR_DEPLOYMENT_ACCESS_URL: "https://pr${{ env.PR_NUMBER }}.${{ secrets.PR_DEPLOYMENTS_DOMAIN }}"
|
||||
|
||||
Reference in New Issue
Block a user