Skip to content

fix: label for issue converter #3

fix: label for issue converter

fix: label for issue converter #3

name: Convert survey JSON from issue
on:
issues:
types:
- labeled
jobs:
from-issue:
# Run when the "convert" label is applied to an issue
if: github.event.action == 'labeled' && github.event.label.name == 'convert'
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Parse issue form data
id: parse
uses: zentered/issue-forms-body-parser@v1.5.1
- name: Extract inputs
id: extract
run: |
echo '${{ steps.parse.outputs.data }}' > issue-data.json
JSON_URL=$(jq -r '.json_url.text' issue-data.json)
CONFIG_SOURCE=$(jq -r '.config_source.text' issue-data.json)
CONFIG_FILE=$(jq -r '.config_file.text' issue-data.json)
CUSTOM_CONFIG=$(jq -r '.custom_config.text' issue-data.json)
echo "json_url=$JSON_URL" >> $GITHUB_OUTPUT
echo "config_source=$CONFIG_SOURCE" >> $GITHUB_OUTPUT
echo "config_file=$CONFIG_FILE" >> $GITHUB_OUTPUT
echo "custom_config<<EOF" >> $GITHUB_OUTPUT
echo "$CUSTOM_CONFIG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Download survey JSON
run: |
curl -L "${{ steps.extract.outputs.json_url }}" -o survey.json
- name: Prepare config (custom only)
run: |
if [ "${{ steps.extract.outputs.config_source }}" = "Paste custom config JSON below" ]; then
cat << 'EOF' > config.runtime.json
${{ steps.extract.outputs.custom_config }}

Check failure on line 54 in .github/workflows/issue-convert-survey.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/issue-convert-survey.yml

Invalid workflow file

You have an error in your yaml syntax on line 54
EOF
fi
- name: Run converter
run: |
if [ "${{ steps.extract.outputs.config_source }}" = "Use config from configs/ folder" ]; then
python convert.py survey.json --config-name="${{ steps.extract.outputs.config_file }}"
else
python convert.py survey.json --config=config.runtime.json
fi
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: survey-conversion
path: |
survey.bbcode.txt
survey.csv
if-no-files-found: error
- name: Comment on issue with artifact link
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ github.event.issue.number }}
body: |
## ✅ Survey conversion finished
You can download the BBCode and CSV artifacts from this workflow run:
https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}