Skip to content

Add macros submodule, open PR in d-morrison/macros, and checkout submodule in Copilot setup #35

Add macros submodule, open PR in d-morrison/macros, and checkout submodule in Copilot setup

Add macros submodule, open PR in d-morrison/macros, and checkout submodule in Copilot setup #35

# GitHub Copilot Setup Steps for qwt
#
# This workflow configures the GitHub Copilot coding agent's environment
# by preinstalling R, Quarto, TinyTeX, and system dependencies.
#
# See: https://docs.github.com/en/copilot/how-tos/use-copilot-agents/coding-agent/customize-the-agent-environment
#
# This workflow sets up:
# - Quarto CLI for rendering
# - TinyTeX for PDF output
name: "Copilot Setup Steps"
# Automatically run the setup steps when they are changed to allow for easy validation,
# and allow manual testing through the repository's "Actions" tab
on:
workflow_dispatch:
push:
paths:
- .github/workflows/copilot-setup-steps.yml
pull_request:
paths:
- .github/workflows/copilot-setup-steps.yml
jobs:
# The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot.
copilot-setup-steps:
runs-on: ubuntu-latest
# Set the permissions to the lowest permissions possible needed for your steps.
# Copilot will be given its own token for its operations.
permissions:
contents: read
# Timeout after 55 minutes (max is 59 for copilot-setup-steps)
timeout-minutes: 55
steps:
# Checkout code - Copilot will do this automatically if we don't,
# but we need it for any repository-specific setup
- name: Checkout code
uses: actions/checkout@v4
# Install system dependencies required for R packages
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libcurl4-openssl-dev \
libssl-dev \
libxml2-dev \
libfontconfig1-dev \
libharfbuzz-dev \
libfribidi-dev \
libfreetype6-dev \
libpng-dev \
libtiff5-dev \
libjpeg-dev
# Set up pandoc for documentation
- name: Set up Pandoc
uses: r-lib/actions/setup-pandoc@v2
# Set up R using the standard GitHub Actions setup
# Using 'release' to get the latest R version
- name: Set up R
uses: r-lib/actions/setup-r@v2
with:
r-version: 'release'
use-public-rspm: true
# Install R packages needed for linting and Quarto rendering
- name: Install R packages
run: |
install.packages(
c("lintr", "rmarkdown"),
repos = "https://packagemanager.posit.co/cran/__linux__/noble/latest"
)
shell: Rscript {0}
# Set up Quarto - required for rendering the website
- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2
with:
tinytex: true
# Verify development environment is properly configured
- name: Verify development environment
run: |
echo "=== Development Environment Status ==="
# Check R installation
Rscript -e 'cat("R version:", R.version.string, "\n")'
# Verify Quarto is installed and working
echo ""
echo "=== Quarto Status ==="
quarto --version
quarto list tools
echo ""
echo "Development environment setup complete!"
- name: Create PR in d-morrison/macros for pending Copilot branch
env:
GH_TOKEN: ${{ secrets.MACROS_REPO_PAT }}
run: |
if [ -z "${GH_TOKEN:-}" ]; then
echo "MACROS_REPO_PAT is not set; skipping macros PR creation."
exit 0
fi
branch="copilot/add-summary-stat-macros"
if ! gh api "repos/d-morrison/macros/git/ref/heads/${branch}" --silent 2>/dev/null; then
echo "Branch ${branch} not found in d-morrison/macros; skipping."
exit 0
fi
existing=$(gh pr list \
--repo d-morrison/macros \
--head "$branch" \
--base main \
--json number \
--jq '.[0].number')
if [ -n "$existing" ]; then
echo "PR #$existing already exists for ${branch} -- nothing to do."
exit 0
fi
body=$(printf '%s\n' \
'Adds commonly-used summary statistic macros that were missing:' \
'' \
'- \Cort, \Cor{x}, \Corf{x}, \Cors{x}{y} -- correlation operator and functions' \
'- \hcort, \hCor{x}, \hCorf{x}, \hCors{x}{y} -- estimated (hat) correlation' \
'- \med, \medf{x} -- median operator and function' \
'- \IQR, \IQRf{x} -- interquartile range operator and function' \
'' \
'These follow the same naming conventions as the existing \Var, \Cov, and \SD macros.')
gh pr create \
--repo d-morrison/macros \
--base main \
--head "$branch" \
--title "feat: add correlation, median, and IQR macros" \
--body "$body" \
--draft
echo "PR created in d-morrison/macros."