diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..86d5774 --- /dev/null +++ b/.github/workflows/ci.yml @@ -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 diff --git a/.github/workflows/vx-tagger.yml b/.github/workflows/vx-tagger.yml new file mode 100644 index 0000000..0947681 --- /dev/null +++ b/.github/workflows/vx-tagger.yml @@ -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 diff --git a/OriginalCode.md b/OriginalCode.md new file mode 100644 index 0000000..b3cd194 --- /dev/null +++ b/OriginalCode.md @@ -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. diff --git a/README.md b/README.md new file mode 100644 index 0000000..7c5437c --- /dev/null +++ b/README.md @@ -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). diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..8fc439b --- /dev/null +++ b/action.yml @@ -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 - <