Skip to content

Commit

Permalink
feat: reusable Asana workflow (#12)
Browse files Browse the repository at this point in the history
* feat: Asana automation workflow

* fix: don't run if it's a Dependabot PR

* fix: rename to .yml

* chore: bump Action versions

* fix: 1.0.5 not allowed

* fix: change required inputs and secrets

* feat: move to in review when review requested

* feat: use MBTA Asana action

* feat: add option for marking merged PRs as complete

* feat: make asana GitHub token optional

* docs: clarify required secrets

* fix: default complete-on-merge to false

* fix: make attaching PR optional

* feat: make trigger configurable

* docs: describe secrets
  • Loading branch information
bklebe authored May 2, 2023
1 parent 3e46b2f commit 769b4bf
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/asana.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
on:
workflow_call:
inputs:
merged-section:
type: string
required: false
description: The Asana project section for tickets with PRs that have been merged. Requires secrets.asana-token.
review-section:
type: string
required: false
description: The Asana project section for tickets with PRs that have a review requested. Requires secrets.asana-token.
complete-on-merge:
type: boolean
default: false
description: Whether to mark tasks for merged PRs as complete. Requires secrets.asana-token.
attach-pr:
type: boolean
default: false
description: Whether to attach the PR to the Asana ticket. Requires secrets.asana-github-secret.
trigger-phrase:
type: string
default: "\\*\\*Asana Ticket:\\*\\*"
description: Phrase to trigger moving ticket between columns.
secrets:
asana-token:
required: false
description: Asana personal access token that GitHub Actions uses to move ticket between sections.
github-secret:
required: false
description: GitHub secret that Asana uses to fetch PR information.
jobs:
move-to-merged-asana-ticket-job:
runs-on: ubuntu-latest
if: inputs.merged-section != '' && github.event.pull_request.merged == true && github.actor != 'dependabot[bot]'
steps:
- name: Move ticket on merge
uses: mbta/[email protected]
with:
asana-pat: ${{ secrets.asana-token }}
trigger-phrase: ${{ inputs.trigger-phrase }}
target-section: ${{ inputs.merged-section }}
mark-complete: ${{ inputs.complete-on-merge }}
move-to-in-review-asana-ticket-job:
runs-on: ubuntu-latest
if: inputs.review-section != '' && github.event.action == 'review_requested' && github.actor != 'dependabot[bot]'
steps:
- name: Move ticket on review requested
uses: mbta/[email protected]
with:
asana-pat: ${{ secrets.asana-token }}
trigger-phrase: ${{ inputs.trigger-phrase }}
target-section: ${{ inputs.review-section }}
create-asana-attachment-job:
runs-on: ubuntu-latest
name: Create pull request attachments on Asana tasks
if: inputs.attach-pr && github.actor != 'dependabot[bot]'
steps:
- name: Create pull request attachments
uses: Asana/[email protected]
id: postAttachment
with:
asana-secret: ${{ secrets.asana-github-secret }}
- name: Log output status
run: echo "Status is ${{ steps.postAttachment.outputs.status }}"

0 comments on commit 769b4bf

Please sign in to comment.