Skip to content

fix: remove redundant grid header cell right border #32

fix: remove redundant grid header cell right border

fix: remove redundant grid header cell right border #32

Workflow file for this run

name: Deploy Review Environment
on:
issue_comment:
types: [created]
permissions:
contents: read
jobs:
slash-command-dispatch:
runs-on: ubuntu-latest
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '/deploy-review') }}
outputs:
should-deploy: ${{ steps.check-command.outputs.should-deploy }}
pr-number: ${{ steps.get-pr.outputs.number }}
pr-head-ref: ${{ steps.get-pr.outputs.head-ref }}
pr-head-repo: ${{ steps.get-pr.outputs.head-repo }}
comment-id: ${{ github.event.comment.id }}
steps:
- name: Check permissions and command
id: check-command
run: |
# Check if user has write permissions
PERMISSION=$(curl -s -H "Authorization: token ${{ secrets.ACTIONS_BOT_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/collaborators/${{ github.event.comment.user.login }}/permission" | \
jq -r '.permission')
if [[ "$PERMISSION" == "admin" || "$PERMISSION" == "write" ]]; then
echo "✅ User has sufficient permissions"
echo "should-deploy=true" >> $GITHUB_OUTPUT
else
echo "❌ User does not have sufficient permissions"
echo "should-deploy=false" >> $GITHUB_OUTPUT
fi
- name: Get PR details
id: get-pr
if: steps.check-command.outputs.should-deploy == 'true'
run: |
PR_DATA=$(curl -s -H "Authorization: token ${{ secrets.ACTIONS_BOT_TOKEN }}" \
"${{ github.event.issue.pull_request.url }}")
echo "number=$(echo "$PR_DATA" | jq -r '.number')" >> $GITHUB_OUTPUT
echo "head-ref=$(echo "$PR_DATA" | jq -r '.head.ref')" >> $GITHUB_OUTPUT
echo "head-repo=$(echo "$PR_DATA" | jq -r '.head.repo.full_name')" >> $GITHUB_OUTPUT
- name: React to comment
run: |
if [[ "${{ steps.check-command.outputs.should-deploy }}" == "true" ]]; then
REACTION="eyes"
else
REACTION="confused"
fi
curl -s -H "Authorization: token ${{ secrets.ACTIONS_BOT_TOKEN }}" \
-X POST \
-d "{\"content\": \"$REACTION\"}" \
"https://api.github.com/repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions"
deploy-review:
runs-on: ubuntu-latest
environment:
name: review
needs: slash-command-dispatch
if: needs.slash-command-dispatch.outputs.should-deploy == 'true'
steps:
- name: Workflow run URL
uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5.0.0
with:
token: ${{ secrets.ACTIONS_BOT_TOKEN }}
repository: ${{ github.repository }}
comment-id: ${{ needs.slash-command-dispatch.outputs.comment-id }}
body: |
>GitHub actions run: [${{ github.run_id }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
- name: Check repository owner
id: owner
run: |
DISPATCHED_REPO_NAME=${{ github.event.repository.name }}
DISPATCHED_REPO_OWNER=${{ github.event.repository.owner.login }}
ERROR_MESSAGE=""
if [[ "$DISPATCHED_REPO_OWNER" != "$GITHUB_REPOSITORY_OWNER" ]]; then
ERROR_MESSAGE="The event was not dispatched by a repository within the same owner."
fi
if [[ "$DISPATCHED_REPO_NAME" != statgpt-* ]]; then
ERROR_MESSAGE+=" The repository name does not start with 'statgpt-'."
fi
if [[ -n "$ERROR_MESSAGE" ]]; then
echo "status=$ERROR_MESSAGE" >> $GITHUB_OUTPUT
exit 1
fi
echo "All checks passed."
- name: Checks and transformations
id: vars
run: |
ERROR_MESSAGE=""
if [[ -z "${{ github.event.repository.name }}" ]]; then
ERROR_MESSAGE="The 'application' argument is missing."
fi
if [[ -z "${{ needs.slash-command-dispatch.outputs.pr-number }}" ]]; then
ERROR_MESSAGE+=" Pull request number is missing."
fi
if [[ -z "${{ needs.slash-command-dispatch.outputs.pr-head-repo }}" ]]; then
ERROR_MESSAGE+=" Pull request head repo full name is missing."
fi
if [[ -z "${{ needs.slash-command-dispatch.outputs.pr-head-ref }}" ]]; then
ERROR_MESSAGE+=" Pull request head ref is missing."
fi
if [[ -n "$ERROR_MESSAGE" ]]; then
echo "status=$ERROR_MESSAGE" >> $GITHUB_OUTPUT
exit 1
fi
echo "All required values are present."
- name: Deploy environment
id: deploy
uses: digital-blueprint/gitlab-pipeline-trigger-action@20e77989b24af658ba138a0aa5291bdc657f1505 # v1.3.0
with:
host: ${{ secrets.DEPLOY_HOST }}
trigger_token: ${{ secrets.DEPLOY_TRIGGER_TOKEN }}
access_token: ${{ secrets.DEPLOY_ACCESS_TOKEN }}
id: ${{ vars.DEPLOY_PROJECT_ID }}
ref: ${{ vars.DEPLOY_REF }}
variables: >
{
"GITHUB_APP": "${{ github.event.repository.name }}",
"GITHUB_PR": "pr-${{ needs.slash-command-dispatch.outputs.pr-number }}",
"GITHUB_REPO": "${{ needs.slash-command-dispatch.outputs.pr-head-repo }}",
"GITHUB_REF": "${{ needs.slash-command-dispatch.outputs.pr-head-ref }}",
"GITHUB_TRIGGER": "${{ github.event.comment.html_url }}"
}
- name: Check status
id: status
if: success() || failure()
run: |
GITHUB_WORKFLOW_URL=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID
GITLAB_PIPELINE_URL=${{ steps.deploy.outputs.web_url }}
MESSAGE=""
if [[ -n "${{ steps.owner.outputs.status }}" ]]; then
MESSAGE+=">- **Owner check failed**: ${{ steps.owner.outputs.status }}\n"
fi
if [[ -n "${{ steps.vars.outputs.status }}" ]]; then
MESSAGE+=">- **Vars check failed**: ${{ steps.vars.outputs.status }}\n"
fi
if [[ -n "${{ steps.deploy.outputs.status }}" && "${{ steps.deploy.outputs.status }}" != "success" ]]; then
MESSAGE+=">- **Deployment failed**: [${{ steps.deploy.outputs.status }}](${GITLAB_PIPELINE_URL})\n"
fi
if [[ -z "${{ steps.owner.outputs.status }}" && -z "${{ steps.vars.outputs.status }}" && -z "${{ steps.deploy.outputs.status }}" ]]; then
MESSAGE+=">Something went wrong, check [GitHub Workflow run output](${GITHUB_WORKFLOW_URL})\n"
fi
echo -e "message=$MESSAGE" >> $GITHUB_OUTPUT
- name: Environment URL
if: success()
uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5.0.0
with:
token: ${{ secrets.ACTIONS_BOT_TOKEN }}
repository: ${{ github.repository }}
comment-id: ${{ needs.slash-command-dispatch.outputs.comment-id }}
body: |
>Environment URL: [review-environment](https://chat-${{ github.event.repository.name }}-pr-${{ needs.slash-command-dispatch.outputs.pr-number }}.${{ vars.REVIEW_BASE_DOMAIN }}) | [pipeline](${{ steps.deploy.outputs.web_url }})
- name: React with rocket on success
if: success()
run: |
curl -s -H "Authorization: token ${{ secrets.ACTIONS_BOT_TOKEN }}" \
-X POST \
-d '{"content": "rocket"}' \
"https://api.github.com/repos/${{ github.repository }}/issues/comments/${{ needs.slash-command-dispatch.outputs.comment-id }}/reactions"
- name: Return status
if: success() || failure()
uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5.0.0
with:
token: ${{ secrets.ACTIONS_BOT_TOKEN }}
repository: ${{ github.repository }}
comment-id: ${{ needs.slash-command-dispatch.outputs.comment-id }}
body: |
${{ steps.status.outputs.message }}