Skip to content

Commit 0a49b25

Browse files
Copilotpelikhan
andauthored
[WIP] Import workflow file from GitHub repository (#213)
* Initial plan * Import shared/sq.md from github/gh-aw Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> Co-authored-by: Peli de Halleux <pelikhan@users.noreply.github.com>
1 parent 8d4b84c commit 0a49b25

1 file changed

Lines changed: 139 additions & 0 deletions

File tree

workflows/shared/sq.md

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
---
2+
steps:
3+
- name: Install sq from GitHub releases
4+
run: |
5+
# Install sq binary from official install script
6+
# This downloads the latest release from GitHub and installs it to /usr/local/bin
7+
/bin/sh -c "$(curl -fsSL https://sq.io/install.sh)"
8+
9+
- name: Verify sq installation
10+
run: |
11+
sq version
12+
echo "sq is installed and ready to use"
13+
---
14+
<!--
15+
## sq Data Wrangler
16+
17+
This shared configuration provides setup for `sq`, a command-line tool that offers jq-style access to structured data sources including SQL databases, CSV, Excel, and other document formats.
18+
19+
### About sq
20+
21+
`sq` is the lovechild of sql+jq. It executes jq-like queries or database-native SQL, can join across sources (e.g., join a CSV file to a Postgres table), and outputs to multiple formats including JSON, Excel, CSV, HTML, Markdown, and XML.
22+
23+
**Links:**
24+
- Documentation: https://sq.io/
25+
- GitHub Repository: https://github.com/neilotoole/sq
26+
- Terminal Trove: https://terminaltrove.com/sq/
27+
- Docker Image: https://github.com/neilotoole/sq/pkgs/container/sq
28+
29+
### Installation
30+
31+
The shared workflow installs the sq binary directly from GitHub releases using the official install script. This downloads the latest version and installs it to `/usr/local/bin`.
32+
33+
### Usage in Workflows
34+
35+
Import this shared configuration to make sq available in your workflow:
36+
37+
```yaml
38+
imports:
39+
- shared/sq.md
40+
```
41+
42+
Then use sq commands in your workflow steps:
43+
44+
```bash
45+
# Inspect a data file
46+
sq inspect database.db
47+
48+
# Query a CSV file with jq-like syntax
49+
sq '.actor | .first_name, .last_name' actors.csv
50+
51+
# Join data from multiple sources
52+
sq '@csv_data | join @postgres_db.users' data.csv
53+
```
54+
55+
### Common Use Cases
56+
57+
1. **Query structured data files**: Use jq-like syntax to query CSV, Excel, JSON files
58+
2. **Cross-source joins**: Combine data from different sources (databases, files)
59+
3. **Data format conversion**: Convert between formats (CSV to JSON, Excel to Markdown, etc.)
60+
4. **Database inspection**: View metadata about database structure
61+
5. **Database operations**: Copy, truncate, or drop tables
62+
6. **Data comparison**: Use `sq diff` to compare tables or databases
63+
64+
### Example Workflow
65+
66+
```yaml
67+
---
68+
on:
69+
workflow_dispatch:
70+
imports:
71+
- shared/sq.md
72+
permissions:
73+
contents: read
74+
safe-outputs:
75+
create-issue:
76+
expires: 2d
77+
title-prefix: "[data-analysis] "
78+
---
79+
80+
# Data Analysis with sq
81+
82+
Analyze the CSV files in the repository using sq and create a summary report.
83+
84+
Use sq to:
85+
1. Inspect the data structure
86+
2. Query for interesting patterns
87+
3. Generate summary statistics
88+
4. Create a formatted report
89+
90+
Available sq commands:
91+
- `sq inspect file.csv`
92+
- `sq '.table | select(.column > 100)' file.csv`
93+
- `sq --json '.table' file.csv`
94+
```
95+
96+
### Tips
97+
98+
- sq is installed directly and available in PATH
99+
- Use relative paths from the workspace root
100+
- Specify output format with flags like `--json`, `--csv`, `--markdown`
101+
- For databases, use connection strings or add sources with `sq add`
102+
- All operations work directly on files in the workspace
103+
-->
104+
105+
You have access to the `sq` data wrangling tool for working with structured data sources.
106+
107+
**sq capabilities:**
108+
- Query CSV, Excel, JSON, and database files using jq-like syntax
109+
- Join data across different source types
110+
- Convert between data formats
111+
- Inspect database structures and metadata
112+
- Perform database operations (copy, truncate, drop tables)
113+
- Compare data with `sq diff`
114+
115+
**Using sq in this workflow:**
116+
The sq binary is installed and available in PATH. Use it directly:
117+
```bash
118+
sq [command] [arguments]
119+
```
120+
121+
**Example commands:**
122+
```bash
123+
# Inspect a data file
124+
sq inspect file.csv
125+
126+
# Query data with jq-like syntax
127+
sq '.table | .column' file.csv
128+
129+
# Output as JSON
130+
sq --json '.table' file.csv
131+
132+
# Filter and aggregate
133+
sq '.table | where(.value > 100) | count' file.csv
134+
135+
# Convert to different format
136+
sq --markdown '.table' file.csv
137+
```
138+
139+
For more information, see: https://sq.io/docs/

0 commit comments

Comments
 (0)