Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explore offline script instructions #24

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions notes/2023-10-19.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kernelspec:
---


# Why did we learn the plubming commands?
# Why did we learn the plumbing commands?

You will not typically use them on a day to day basis, but they are a good way to see what happens at the interim steps and make sure that you have the right understanding of what git does.

Expand Down Expand Up @@ -1061,4 +1061,4 @@ save your command history to `2023-10-19-log.txt` and put that file in your KWL

```{note}
due to scheduling issues this will be late today
```
```
55 changes: 55 additions & 0 deletions resources/offlinebadgeinstructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Offline Badge Script Tutorial

If you'd like to start doing your work offline in your local kwl clone but don't have the body of the most recent issue you can follow the following steps to write your own script to get the badge instructions.

## Getting Started

For later in the script you will need .jq to run the script correctly. The download can be found [here.](https://cameronnokes.com/blog/working-with-json-in-bash-using-jq/).

To get started with creating a script that gets offline badge instructions you need to create a file for the script to run:
```{toggle}
touch badgeinstructions.sh
```

Now you will need to open that file, and type the following on the first line:
```{toggle}
#!/bin/bash
```

Then on the 2nd line you will need to enter:
```{toggle}
outputfile="offline_badge_instructions-$(date "+%Y-%m-%d").md"
```

Then, you will need to write this on the next line:
```{toggle}
badgeissue=$(gh issue list --label review -L 1 --json number | jq -r '.[0].number')
```
Here we are getting the issue list, sorting by review, getting the most recent review issue, and getting the issue number with json.
Then we're going to pipe a jq -r '.[0].number' command to get the raw output of the gh command and we get the number of the issue for our variable.

*Note*: If you want to change the badge type you need to replace review with practice in the label part of the badgeissue command.


Next we're going to make a variable called badgeinstructions and assign the gh issue view command to it:
```{toggle}
badgeinstructions=$(gh issue view $badgeissue)
```

Next we're gonna echo a title for the top of the output file:
```{toggle}
echo "Most Recent Badge Instructions" >> $outputfile
```

Now we're gonna echo the badgeinstructions into the output file as well:
```{toggle}
echo "$badgeinstructions" >> $outputfile
```

Once we do this we should be all set to run the script:

```{toggle}
bash badgeinstructions.sh
```

Now we are all set!
Loading