Skip to content

Commit f81af19

Browse files
committed
.some(sh)
1 parent 5ad5bc3 commit f81af19

5 files changed

Lines changed: 112 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
on:
2+
workflow_dispatch:
3+
pull_request:
4+
paths:
5+
- action.yml
6+
- .github/workflows/ci.yml
7+
jobs:
8+
ci-1:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- uses: ./
13+
with:
14+
today: 1
15+
token: ${{ secrets.GITHUB_TOKEN }}
16+
ci-2:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v2
20+
- uses: ./
21+
env:
22+
GTD_TODAY: 1

.github/workflows/vx-tagger.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
on:
2+
release:
3+
types: [published, updated]
4+
jobs:
5+
tag:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v2
9+
- uses: sersoft-gmbh/running-release-tags-action@master
10+
with:
11+
github-token: ${{secrets.GITHUB_TOKEN}}
12+
update-full-release: true
13+
if: github.event.release.prerelease == false

OriginalCode.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Original Code
2+
3+
Here is the original code before it was adapted into a standalone GitHub Action:
4+
5+
```yaml
6+
jobs:
7+
fortune:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- run: |
11+
set -euxo pipefail
12+
FORTUNE=$(curl http://yerkee.com/api/fortune -s | jq -r .fortune)
13+
FORTUNE="${FORTUNE//'%'/'%25'}"
14+
FORTUNE="${FORTUNE//$'\n'/'%0A'}"
15+
FORTUNE="${FORTUNE//$'\r'/'%0D'}"
16+
echo "::set-output name=value::$FORTUNE"
17+
id: fortune
18+
- uses: peter-evans/create-or-update-comment@v1
19+
with:
20+
issue-number: ${{ needs.daily.outputs.issue }}
21+
body: |
22+
# Fortune
23+
${{ steps.fortune.outputs.value }}
24+
```
25+
26+
It’s unfortunate actions cannot call other actions.

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# “Fortune” for Git Things Done
2+
3+
Adds a fortune comment to your [Git Things Done](https://github.com/git-things-done/gtd).
4+
5+
```yaml
6+
jobs:
7+
git-things-done:
8+
# [snip]…
9+
- uses: git-things-done/fortune@v1
10+
continue-on-error: true # HTTP can be flakey
11+
```
12+
13+
Examples in our [CI Ticket](../../issues/1).

action.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: “Fortune” for Git Things Done
2+
description: Adds a fortune to your “Git Things Done” entry
3+
inputs:
4+
today:
5+
description: >
6+
The current GitTD issue number.
7+
If unset we use `$GTD_TODAY`.
8+
required: false
9+
token:
10+
description: Typically (eg. {{ secrets.GITHUB_TOKEN }}).
11+
default: ${{ github.token }}
12+
outputs:
13+
fortune:
14+
description: The fortune added to the journal entry
15+
value: ${{ steps.fortune.outputs.value }}
16+
runs:
17+
using: composite
18+
steps:
19+
- run: |
20+
set -euo pipefail
21+
FORTUNE=$(curl http://yerkee.com/api/fortune -s | jq -r .fortune)
22+
gh issue comment "$TODAY" --body-file - <<EOD
23+
# Fortune
24+
$FORTUNE
25+
EOD
26+
FORTUNE="${FORTUNE//'%'/'%25'}"
27+
FORTUNE="${FORTUNE//$'\n'/'%0A'}"
28+
FORTUNE="${FORTUNE//$'\r'/'%0D'}"
29+
echo "::set-output name=value::$FORTUNE"
30+
shell: bash
31+
id: fortune
32+
env:
33+
TODAY: ${{ inputs.today || env.GTD_TODAY }}
34+
GITHUB_TOKEN: ${{ inputs.token }}
35+
36+
branding:
37+
icon: check-square
38+
color: green

0 commit comments

Comments
 (0)