-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
112 additions
and
0 deletions.
There are no files selected for viewing
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
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 |
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
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 |
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
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. |
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
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). |
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
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 |