Created
December 31, 2022 22:54
-
-
Save egregius313/281e269db0a8b66621a14021d7c6c1e9 to your computer and use it in GitHub Desktop.
Script for pasting a list of PRs in Slack using Alfred
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
# Get the GitHub username from ~/.gitconfig | |
USERNAME=$(git config github.user) | |
# Replace this with the relevant repository | |
REPO=github/codeql | |
gh pr list -A "$USERNAME" -R $REPO --json isDraft,title,labels,url \ | |
| jq -r ' | |
# Get the draft status of the PR and translate it to the GitHub Slack emoji | |
def pr_status: if .isDraft then ":pr-draft:" else ":pr-open:" end ; | |
# On my team, we mark whether a PR is ready for review by the documentation team with | |
# a label `ready-for-doc-review`. This can be changed accordingly. | |
def ready_for_docs_review: .labels | map(select(.name == "ready-for-doc-review")) | length > 0 ; | |
.[] | "- " + pr_status + (if ready_for_docs_review then " (Docs review) " else " " end) + .title + ": " + .url' \ | |
| tac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment