Skip to content

Fine personas socialai tutorial #494

Fine personas socialai tutorial

Fine personas socialai tutorial #494

Workflow file for this run

name: Publish PR documentation
on:
pull_request:
types:
- opened
- synchronize
concurrency:
group: distilabel-docs
cancel-in-progress: false
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: checkout docs-site
uses: actions/checkout@v4
with:
ref: gh-pages
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# Looks like it's not working very well for other people:
# https://github.com/actions/setup-python/issues/436
# cache: "pip"
# cache-dependency-path: pyproject.toml
- uses: actions/cache@v3
id: cache
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-docs-pr-v00
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: pip install -e .[docs]
- name: Set git credentials
run: |
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
- name: Deploy hidden docs for PR
run: |
PR_NUMBER=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')
mike deploy pr-$PR_NUMBER --prop-set hidden=true --push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Comment PR with docs link
uses: actions/github-script@v7
with:
script: |
const pr_number = context.payload.pull_request.number;
const owner = context.repo.owner;
const repo = context.repo.repo;
// Check if a comment already exists
const comments = await github.rest.issues.listComments({
issue_number: pr_number,
owner: owner,
repo: repo
});
const botComment = comments.data.find(comment =>
comment.user.type === 'Bot' &&
comment.body.includes('Documentation for this PR has been built')
);
if (!botComment) {
// Post new comment only if it doesn't exist
await github.rest.issues.createComment({
issue_number: pr_number,
owner: owner,
repo: repo,
body: `Documentation for this PR has been built. You can view it at: https://distilabel.argilla.io/pr-${pr_number}/`
});
}