mirror of
https://github.com/jbranchaud/til
synced 2026-01-19 15:08:02 +00:00
Compare commits
2 Commits
570dbdb745
...
c185ac18c5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c185ac18c5 | ||
|
|
3c7899c67d |
@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
|
||||
|
||||
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
|
||||
|
||||
_1317 TILs and counting..._
|
||||
_1319 TILs and counting..._
|
||||
|
||||
---
|
||||
|
||||
@@ -346,6 +346,7 @@ _1317 TILs and counting..._
|
||||
|
||||
- [Cache Playwright Dependencies Across Workflows](github-actions/cache-playwright-dependencies-across-workflows.md)
|
||||
- [Capture An Output Value For Use In A Later Step](github-actions/capture-an-output-value-for-use-in-a-later-step.md)
|
||||
- [Disable A Workflow With The gh CLI](github-actions/disable-a-workflow-with-the-gh-cli.md)
|
||||
- [Reference An Encrypted Secret In An Action](github-actions/reference-an-encrypted-secret-in-an-action.md)
|
||||
- [Trigger A Workflow Via An API Call](github-actions/trigger-a-workflow-via-an-api-call.md)
|
||||
|
||||
@@ -1268,6 +1269,7 @@ _1317 TILs and counting..._
|
||||
- [Find Duplicate Lines In A File](unix/find-duplicate-lines-in-a-file.md)
|
||||
- [Find Files With fd](unix/find-files-with-fd.md)
|
||||
- [Find Newer Files](unix/find-newer-files.md)
|
||||
- [Find Occurrences Of Multiple Values With Ripgrep](unix/find-occurrences-of-multiple-values-with-ripgrep.md)
|
||||
- [Fix Unlinked Node Binaries With asdf](unix/fix-unlinked-node-binaries-with-asdf.md)
|
||||
- [Forward Multiple Ports Over SSH](unix/forward-multiple-ports-over-ssh.md)
|
||||
- [Generate A SAML Key And Certificate Pair](unix/generate-a-saml-key-and-certificate-pair.md)
|
||||
|
||||
41
github-actions/disable-a-workflow-with-the-gh-cli.md
Normal file
41
github-actions/disable-a-workflow-with-the-gh-cli.md
Normal file
@@ -0,0 +1,41 @@
|
||||
# Disable A Workflow With The gh CLI
|
||||
|
||||
You may want to temporarily disable a GitHub Actions workflow without deleting
|
||||
the file for the workflow. In my case, this is handy because I want to keep a
|
||||
scheduled workflow around as a point of reference, but I don't want it running
|
||||
all the time.
|
||||
|
||||
This can be done with [the `workflow` subcommand of the `gh`
|
||||
CLI](https://docs.github.com/en/actions/using-workflows/disabling-and-enabling-a-workflow?tool=cli).
|
||||
|
||||
First, list the workflows for your current repo so that you can figure out the
|
||||
workflow ID that you want to disable.
|
||||
|
||||
```bash
|
||||
$ gh workflow list
|
||||
GitHub Actions Demo active 60018591
|
||||
Playwright Demo active 60142509
|
||||
Scheduled Actions Demo active 60028624
|
||||
```
|
||||
|
||||
Now, copy the ID of the workflow you want to disable. In my case, it is
|
||||
`60028624`.
|
||||
|
||||
Then, run the `disable` command for that workflow ID:
|
||||
|
||||
```bash
|
||||
$ gh workflow disable 60028624
|
||||
✓ Disabled Scheduled Actions Demo
|
||||
```
|
||||
|
||||
That workflow is now disabled and it is no longer going to show up in the
|
||||
default listing of workflows.
|
||||
|
||||
If you want to see it in the list though, you can include the `--all` flag.
|
||||
|
||||
```bash
|
||||
$ gh workflow list --all
|
||||
GitHub Actions Demo active 60018591
|
||||
Playwright Demo active 60142509
|
||||
Scheduled Actions Demo disabled_manually 60028624
|
||||
```
|
||||
25
unix/find-occurrences-of-multiple-values-with-ripgrep.md
Normal file
25
unix/find-occurrences-of-multiple-values-with-ripgrep.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# Find Occurrences Of Multiple Values With Ripgrep
|
||||
|
||||
Let's say I have a several values that show up throughout the files in my
|
||||
project. They are `Valid`, `Restricted`, `Refunded`, `Disputed`, and `Banned`.
|
||||
|
||||
I want to find all occurrences of each of these values.
|
||||
|
||||
This can be done with [`rg` (ripgrep)](https://github.com/BurntSushi/ripgrep)
|
||||
and a bit of regex.
|
||||
|
||||
```bash
|
||||
rg "\b(Valid|Restricted|Refunded|Disputed|Banned)\b"
|
||||
```
|
||||
|
||||
This uses `\b` on both ends to indicate word boundaries. This ensures it
|
||||
matches on `Valid` without also matching on `Validate`. It then wraps all the
|
||||
options in parentheses separated by `|` which says, "match on this word, this
|
||||
word, ..., or this word".
|
||||
|
||||
I can even take this a step further by only matching on quoted instances of
|
||||
these words like so:
|
||||
|
||||
```bash
|
||||
$ rg "[\"']\b(Valid|Restricted|Refunded|Disputed|Banned)\b[\"']"
|
||||
```
|
||||
Reference in New Issue
Block a user