Skip to content

Import experiment

Import experiment #15

name: Import experiment
on:
workflow_dispatch:
inputs:
experiment_id:
description: ID of the experiment in Nimbus
required: true
issue_number:
description: Reference issue number (leave empty to create one)
required: false
default: ""
jobs:
linter:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install Python dependencies
run: |
pip install -r .github/requirements.txt
- name: Generate localization file and create issue if necessary
run: >
python .github/scripts/import_experiment.py
--id "${{ github.event.inputs.experiment_id }}"
--issue "${{ github.event.inputs.issue_number }}"
--repo ${{ github.repository }}
--toml l10n.toml
--token ${{ secrets.API_GITHUB_TOKEN }}
- name: Store ENV variables
id: env-variables
run: |
# If a new issue was created, need to use the issue number from experiments.json
if [ "${{ github.event.inputs.issue_number }}" = "" ]; then
issue_number=$(jq -r '."${{ github.event.inputs.experiment_id }}" | .issue' .github/storage/experiments.json)
else
issue_number=${{ github.event.inputs.issue_number }}
fi
echo "issue_number=${issue_number}" >> $GITHUB_OUTPUT
- name: Create pull request
id: cpr
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.API_GITHUB_TOKEN }}
branch: "exp-${{ github.event.inputs.experiment_id }}"
author: l10n-bot <[email protected]>
commit-message: "Set up localization for experiment ${{ github.event.inputs.experiment_id }}"
title: "Set up localization for experiment ${{ github.event.inputs.experiment_id }}"
body: "See issue https://github.com/${{ github.repository }}/issues/${{ steps.env-variables.outputs.issue_number }}"
- name: Add comment to issue
run: >
gh issue comment ${{ steps.env-variables.outputs.issue_number }}
--repo ${{ github.repository }}
--body "Created pull request: ${{ steps.cpr.outputs.pull-request-url }}"
env:
GH_TOKEN: ${{ secrets.API_GITHUB_TOKEN }}