feat: change return error code #19463
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PR | |
on: | |
pull_request: | |
jobs: | |
assign-label-to-pr: | |
runs-on: ubuntu-latest | |
if: ${{ !github.event.pull_request.head.repo.fork }} | |
steps: | |
- uses: codelytv/pr-size-labeler@v1 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
xs_max_size: '10' | |
s_max_size: '100' | |
m_max_size: '500' | |
l_max_size: '1000' | |
fail_if_xl: 'false' | |
- uses: actions/labeler@v3 | |
with: | |
repo-token: "${{ secrets.GITHUB_TOKEN }}" | |
- id: docs_updated | |
if: contains( github.event.pull_request.labels.*.name, 'area/docs') | |
run: echo "docs=true" >> $GITHUB_OUTPUT | |
outputs: | |
docs: ${{ steps.docs_updated.outputs.docs }} | |
deploy-to-netlify: | |
runs-on: ubuntu-latest | |
needs: [assign-label-to-pr] | |
if: ${{ needs.assign-label-to-pr.outputs.docs == 'true' }} | |
steps: | |
- run: | | |
echo "BRANCH_NAME=${{ github.head_ref }}" >> $GITHUB_ENV | |
- uses: actions/[email protected] | |
with: | |
repository: jina-ai/jina | |
ref: ${{ env.BRANCH_NAME }} | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.7 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '14' | |
- name: Build and Deploy | |
timeout-minutes: 30 | |
run: | | |
npm i -g netlify-cli | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
git fetch origin | |
export NUM_RELEASES=2 # only 2 last tags to save build time | |
bash makedoc.sh local-only | |
netlify deploy --dir=./_build/dirhtml --alias=${{ env.BRANCH_NAME }} --message="Deploying docs to ${{ env.BRANCH_NAME }} branch" | |
env: | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
working-directory: docs | |
- name: Find the prev comment if exists | |
uses: peter-evans/find-comment@v1 | |
id: fc | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
comment-author: 'github-actions[bot]' | |
body-includes: 'Docs are deployed' | |
- name: Delete comment if exists | |
if: ${{ steps.fc.outputs.comment-id != 0 && !github.event.pull_request.head.repo.fork }} | |
uses: actions/github-script@v3 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
github.issues.deleteComment({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
comment_id: ${{ steps.fc.outputs.comment-id }}, | |
}) | |
- name: Add or update comment | |
uses: peter-evans/create-or-update-comment@v1 | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
body: | | |
:memo: Docs are deployed on https://${{ env.BRANCH_NAME }}--jina-docs.netlify.app :tada: |