Skip to content

Add approach to flexibly inject system_messages #873

Add approach to flexibly inject system_messages

Add approach to flexibly inject system_messages #873

Workflow file for this run

name: Publish PR documentation
on:
pull_request:
types:
- opened
- synchronize
concurrency:
group: distilabel-docs
cancel-in-progress: false
permissions:
contents: write
pull-requests: write
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@v5
with:
python-version: "3.11"
- uses: actions/cache@v4
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: ./scripts/install_docs_dependencies.sh
- 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}/`
});
}