https://github.com/jdcasey/myshift
PagerDuty shift planner
https://github.com/jdcasey/myshift
Last synced: 11 months ago
JSON representation
PagerDuty shift planner
- Host: GitHub
- URL: https://github.com/jdcasey/myshift
- Owner: jdcasey
- License: apache-2.0
- Created: 2025-06-13T22:13:00.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-18T19:53:03.000Z (about 1 year ago)
- Last Synced: 2025-08-31T07:39:12.493Z (11 months ago)
- Language: Python
- Size: 5.69 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# myshift
A command-line tool for managing on-call schedules in PagerDuty.
## Installation
### From Source
```bash
git clone https://github.com/jdcasey/myshift.git
cd myshift
pip install -e .
```
### From Container
```bash
# Using podman
podman run -it --rm -v /path/to/myshift.yaml:/etc/myshift.yaml quay.io/jdcasey/myshift
# Using docker
docker run -it --rm -v /path/to/myshift.yaml:/etc/myshift.yaml quay.io/jdcasey/myshift
```
### From PyPI
```bash
pip install myshift
```
## Configuration
Create a `myshift.yaml` file in one of the following standard locations:
### Linux
- `$XDG_CONFIG_HOME/myshift.yaml` (if XDG_CONFIG_HOME is set)
- `~/.config/myshift.yaml` (default if XDG_CONFIG_HOME is not set)
### macOS
- `~/Library/Application Support/myshift.yaml`
You can generate a sample configuration file by running:
```bash
myshift config --print
```
The configuration file should have the following structure:
```yaml
# PagerDuty API token
token: "your-pagerduty-token"
# Default schedule ID (optional)
# schedule_id: "your-default-schedule-id"
# Your PagerDuty user ID or email (optional)
# This will be used when no --user-id or --user-email is provided
# my_user: "your-email@example.com" # or "your-user-id"
```
- `token`: Your PagerDuty API token (required)
- `schedule_id`: The ID of your PagerDuty schedule (optional)
- `my_user`: Your PagerDuty user ID or email address (optional)
## Usage
### Container Usage
```bash
# Using podman
podman run -it --rm -v /path/to/myshift.yaml:/etc/myshift.yaml myshift
# Using docker
docker run -it --rm -v /path/to/myshift.yaml:/etc/myshift.yaml myshift
```
**NOTE:** When you run in container mode, the `repl` command will be used.
### Command Line Usage
#### Show Next On-Call Shift
```bash
myshift next [schedule_id] [--user-id USER_ID | --user-email USER_EMAIL]
```
Shows your next on-call shift. If no user is specified, uses the `my_user` from your configuration.
#### Show Upcoming On-Call Shifts
```bash
myshift upcoming [schedule_id] [--user-id USER_ID | --user-email USER_EMAIL] [--weeks WEEKS]
```
Shows your upcoming on-call shifts for the next N weeks (default: 4).
#### Show All On-Call Shifts
```bash
myshift plan [schedule_id] [--weeks WEEKS] [--utc]
```
Shows all on-call shifts in the schedule for the next N weeks (default: 4). Use `--utc` to display times in UTC instead of local timezone.
## Development
### Setup
1. Clone the repository
2. Install development dependencies:
```bash
pip install -e ".[dev]"
```
### Running Tests
```bash
pytest
```
### Code Style
This project uses:
- black for code formatting
- flake8 for linting
- mypy for type checking
Run all checks with:
```bash
pre-commit run --all-files
```
## License
Apache License 2.0