Skip to content

Commit

Permalink
.some(sh)
Browse files Browse the repository at this point in the history
  • Loading branch information
mxcl committed Nov 20, 2021
1 parent 5ad5bc3 commit f81af19
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
on:
workflow_dispatch:
pull_request:
paths:
- action.yml
- .github/workflows/ci.yml
jobs:
ci-1:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ./
with:
today: 1
token: ${{ secrets.GITHUB_TOKEN }}
ci-2:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ./
env:
GTD_TODAY: 1
13 changes: 13 additions & 0 deletions .github/workflows/vx-tagger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
on:
release:
types: [published, updated]
jobs:
tag:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: sersoft-gmbh/running-release-tags-action@master
with:
github-token: ${{secrets.GITHUB_TOKEN}}
update-full-release: true
if: github.event.release.prerelease == false
26 changes: 26 additions & 0 deletions OriginalCode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Original Code

Here is the original code before it was adapted into a standalone GitHub Action:

```yaml
jobs:
fortune:
runs-on: ubuntu-latest
steps:
- run: |
set -euxo pipefail
FORTUNE=$(curl http://yerkee.com/api/fortune -s | jq -r .fortune)
FORTUNE="${FORTUNE//'%'/'%25'}"
FORTUNE="${FORTUNE//$'\n'/'%0A'}"
FORTUNE="${FORTUNE//$'\r'/'%0D'}"
echo "::set-output name=value::$FORTUNE"
id: fortune
- uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ needs.daily.outputs.issue }}
body: |
# Fortune
${{ steps.fortune.outputs.value }}
```
It’s unfortunate actions cannot call other actions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# “Fortune” for Git Things Done

Adds a fortune comment to your [Git Things Done](https://github.com/git-things-done/gtd).

```yaml
jobs:
git-things-done:
# [snip]…
- uses: git-things-done/fortune@v1
continue-on-error: true # HTTP can be flakey
```
Examples in our [CI Ticket](../../issues/1).
38 changes: 38 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: “Fortune” for Git Things Done
description: Adds a fortune to your “Git Things Done” entry
inputs:
today:
description: >
The current GitTD issue number.
If unset we use `$GTD_TODAY`.
required: false
token:
description: Typically (eg. {{ secrets.GITHUB_TOKEN }}).
default: ${{ github.token }}
outputs:
fortune:
description: The fortune added to the journal entry
value: ${{ steps.fortune.outputs.value }}
runs:
using: composite
steps:
- run: |
set -euo pipefail
FORTUNE=$(curl http://yerkee.com/api/fortune -s | jq -r .fortune)
gh issue comment "$TODAY" --body-file - <<EOD
# Fortune
$FORTUNE
EOD
FORTUNE="${FORTUNE//'%'/'%25'}"
FORTUNE="${FORTUNE//$'\n'/'%0A'}"
FORTUNE="${FORTUNE//$'\r'/'%0D'}"
echo "::set-output name=value::$FORTUNE"
shell: bash
id: fortune
env:
TODAY: ${{ inputs.today || env.GTD_TODAY }}
GITHUB_TOKEN: ${{ inputs.token }}
branding:
icon: check-square
color: green

0 comments on commit f81af19

Please sign in to comment.