mirror of
https://github.com/mattermost/mattermost.git
synced 2026-08-26 21:27:40 -05:00
ci: consolidate docs-preview checks into one status with preview URL (#37524)
* ci: consolidate docs-preview checks into one status with preview URL Drop the same-repo status-update jobs that cluttered the PR checks list, and post a single docs-preview commit status whose Details link opens the preview environment. Co-authored-by: Cursor <cursoragent@cursor.com> * remove comment * Remove duplicate failure status update in docs-preview-fork workflow The deploy job already posts a failure commit status via the shared template, making the separate update-failure-status job redundant. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -7,10 +7,6 @@ on:
|
||||
type: string
|
||||
required: true
|
||||
description: "PR number (fork PR to build preview for)"
|
||||
TRIGGERING_ACTOR:
|
||||
type: string
|
||||
required: true
|
||||
description: "GitHub login of the fork PR author"
|
||||
COMMIT_SHA:
|
||||
type: string
|
||||
required: true
|
||||
@@ -31,11 +27,11 @@ jobs:
|
||||
with:
|
||||
repository_full_name: ${{ github.repository }}
|
||||
commit_sha: ${{ inputs.COMMIT_SHA }}
|
||||
context: "docs-preview-fork / preview"
|
||||
context: docs-preview
|
||||
description: "Docs preview build for ${{ inputs.COMMIT_SHA }} is running"
|
||||
status: pending
|
||||
|
||||
preview:
|
||||
deploy:
|
||||
uses: ./.github/workflows/docs-preview-template.yml
|
||||
secrets:
|
||||
AWS_DOCS_PR_PREVIEW_KEY_ID: ${{ secrets.AWS_DOCS_PR_PREVIEW_KEY_ID }}
|
||||
@@ -45,36 +41,4 @@ jobs:
|
||||
with:
|
||||
PR_NUMBER: ${{ inputs.PR_NUMBER }}
|
||||
COMMIT_SHA: ${{ inputs.COMMIT_SHA }}
|
||||
|
||||
update-failure-status:
|
||||
runs-on: ubuntu-latest
|
||||
if: failure() || cancelled()
|
||||
needs:
|
||||
- preview
|
||||
steps:
|
||||
- uses: mattermost/actions/delivery/update-commit-status@fec7b836001c9380d4bfaf28d443945c103a098c
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
with:
|
||||
repository_full_name: ${{ github.repository }}
|
||||
commit_sha: ${{ inputs.COMMIT_SHA }}
|
||||
context: "docs-preview-fork / preview"
|
||||
description: "Docs preview build for ${{ inputs.COMMIT_SHA }} failed"
|
||||
status: failure
|
||||
|
||||
update-success-status:
|
||||
runs-on: ubuntu-latest
|
||||
if: success()
|
||||
needs:
|
||||
- preview
|
||||
steps:
|
||||
- uses: mattermost/actions/delivery/update-commit-status@fec7b836001c9380d4bfaf28d443945c103a098c
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
with:
|
||||
repository_full_name: ${{ github.repository }}
|
||||
commit_sha: ${{ inputs.COMMIT_SHA }}
|
||||
context: "docs-preview-fork / preview"
|
||||
description: "Docs preview build for ${{ inputs.COMMIT_SHA }} succeeded"
|
||||
status: success
|
||||
target_url: "http://${{ vars.DOCS_PREVIEW_BUCKET_NAME }}.s3-website-us-east-1.amazonaws.com/mattermost/pr-${{ inputs.PR_NUMBER }}/"
|
||||
STATUS_CONTEXT: docs-preview
|
||||
|
||||
@@ -9,6 +9,12 @@ on:
|
||||
COMMIT_SHA:
|
||||
type: string
|
||||
required: true
|
||||
# Commit status context shown on the PR. Details (⋯) links to the preview
|
||||
# when status is success. Empty skips status updates.
|
||||
STATUS_CONTEXT:
|
||||
type: string
|
||||
required: false
|
||||
default: docs-preview
|
||||
secrets:
|
||||
AWS_DOCS_PR_PREVIEW_KEY_ID:
|
||||
required: true
|
||||
@@ -23,10 +29,10 @@ concurrency:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
statuses: write
|
||||
|
||||
jobs:
|
||||
preview:
|
||||
name: Build and deploy preview
|
||||
deploy:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -89,3 +95,37 @@ jobs:
|
||||
"s3://${BUCKET_NAME}/mattermost/pr-${PR_NUMBER}/" \
|
||||
--delete \
|
||||
--no-progress
|
||||
|
||||
- name: Set preview URL
|
||||
id: preview
|
||||
env:
|
||||
BUCKET_NAME: ${{ vars.DOCS_PREVIEW_BUCKET_NAME }}
|
||||
PR_NUMBER: ${{ inputs.PR_NUMBER }}
|
||||
run: |
|
||||
echo "url=http://${BUCKET_NAME}.s3-website-us-east-1.amazonaws.com/mattermost/pr-${PR_NUMBER}/" >> "$GITHUB_OUTPUT"
|
||||
|
||||
# Details (⋯) on this check links to the preview URL via target_url.
|
||||
- name: Set success commit status
|
||||
if: ${{ inputs.STATUS_CONTEXT != '' }}
|
||||
uses: mattermost/actions/delivery/update-commit-status@fec7b836001c9380d4bfaf28d443945c103a098c
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
with:
|
||||
repository_full_name: ${{ github.repository }}
|
||||
commit_sha: ${{ inputs.COMMIT_SHA }}
|
||||
context: ${{ inputs.STATUS_CONTEXT }}
|
||||
description: "Docs preview build for ${{ inputs.COMMIT_SHA }} succeeded"
|
||||
status: success
|
||||
target_url: ${{ steps.preview.outputs.url }}
|
||||
|
||||
- name: Set failure commit status
|
||||
if: ${{ always() && inputs.STATUS_CONTEXT != '' && (failure() || cancelled()) }}
|
||||
uses: mattermost/actions/delivery/update-commit-status@fec7b836001c9380d4bfaf28d443945c103a098c
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
with:
|
||||
repository_full_name: ${{ github.repository }}
|
||||
commit_sha: ${{ inputs.COMMIT_SHA }}
|
||||
context: ${{ inputs.STATUS_CONTEXT }}
|
||||
description: "Docs preview build for ${{ inputs.COMMIT_SHA }} failed"
|
||||
status: failure
|
||||
|
||||
@@ -12,62 +12,13 @@ permissions:
|
||||
statuses: write
|
||||
|
||||
jobs:
|
||||
update-initial-status:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event.pull_request.head.repo.full_name == github.repository
|
||||
steps:
|
||||
- name: Set pending commit status
|
||||
uses: mattermost/actions/delivery/update-commit-status@fec7b836001c9380d4bfaf28d443945c103a098c
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
with:
|
||||
repository_full_name: ${{ github.repository }}
|
||||
commit_sha: ${{ github.event.pull_request.head.sha }}
|
||||
context: "docs-preview / preview"
|
||||
description: "Docs preview build for ${{ github.event.pull_request.head.sha }} is running"
|
||||
status: pending
|
||||
|
||||
deploy:
|
||||
uses: ./.github/workflows/docs-preview-template.yml
|
||||
if: github.event.pull_request.head.repo.full_name == github.repository
|
||||
needs:
|
||||
- update-initial-status
|
||||
secrets:
|
||||
AWS_DOCS_PR_PREVIEW_KEY_ID: ${{ secrets.AWS_DOCS_PR_PREVIEW_KEY_ID }}
|
||||
AWS_DOCS_PR_PREVIEW_SECRET_ACCESS_KEY: ${{ secrets.AWS_DOCS_PR_PREVIEW_SECRET_ACCESS_KEY }}
|
||||
with:
|
||||
PR_NUMBER: ${{ github.event.number }}
|
||||
COMMIT_SHA: ${{ github.event.pull_request.head.sha }}
|
||||
|
||||
update-failure-status:
|
||||
runs-on: ubuntu-latest
|
||||
if: failure() || cancelled()
|
||||
needs:
|
||||
- deploy
|
||||
steps:
|
||||
- uses: mattermost/actions/delivery/update-commit-status@fec7b836001c9380d4bfaf28d443945c103a098c
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
with:
|
||||
repository_full_name: ${{ github.repository }}
|
||||
commit_sha: ${{ github.event.pull_request.head.sha }}
|
||||
context: "docs-preview / preview"
|
||||
description: "Docs preview build for ${{ github.event.pull_request.head.sha }} failed"
|
||||
status: failure
|
||||
|
||||
update-success-status:
|
||||
runs-on: ubuntu-latest
|
||||
if: success()
|
||||
needs:
|
||||
- deploy
|
||||
steps:
|
||||
- uses: mattermost/actions/delivery/update-commit-status@fec7b836001c9380d4bfaf28d443945c103a098c
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
with:
|
||||
repository_full_name: ${{ github.repository }}
|
||||
commit_sha: ${{ github.event.pull_request.head.sha }}
|
||||
context: "docs-preview / preview"
|
||||
description: "Docs preview build for ${{ github.event.pull_request.head.sha }} succeeded"
|
||||
status: success
|
||||
target_url: "http://${{ vars.DOCS_PREVIEW_BUCKET_NAME }}.s3-website-us-east-1.amazonaws.com/mattermost/pr-${{ github.event.number }}/"
|
||||
STATUS_CONTEXT: docs-preview
|
||||
|
||||
Reference in New Issue
Block a user