Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: only run Asana jobs if the secrets are present #14

Merged
merged 1 commit into from
Jul 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions .github/workflows/asana.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,17 @@ on:
required: false
description: GitHub secret that Asana uses to fetch PR information.
jobs:
check-for-secrets:
runs-on: ubuntu-latest
outputs:
has-asana-token: ${{ secrets.asana-token != '' }}
has-github-secret: ${{ secrets.github-secret != '' }}
steps:
- run: true
move-to-merged-asana-ticket-job:
runs-on: ubuntu-latest
if: inputs.merged-section != '' && github.event.pull_request.merged == true && github.actor != 'dependabot[bot]'
needs: check-for-secrets
if: inputs.merged-section != '' && needs.check-for-secrets.output.has-asana-token == 'true' && github.event.pull_request.merged == true && github.actor != 'dependabot[bot]'
steps:
- name: Move ticket on merge
uses: mbta/[email protected]
Expand All @@ -42,7 +50,8 @@ jobs:
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]'
needs: check-for-secrets
if: inputs.review-section != '' && needs.check-for-secrets.output.has-asana-token == 'true' && github.event.action == 'review_requested' && github.actor != 'dependabot[bot]'
steps:
- name: Move ticket on review requested
uses: mbta/[email protected]
Expand All @@ -52,8 +61,9 @@ jobs:
target-section: ${{ inputs.review-section }}
create-asana-attachment-job:
runs-on: ubuntu-latest
needs: check-for-secrets
name: Create pull request attachments on Asana tasks
if: inputs.attach-pr && github.actor != 'dependabot[bot]'
if: inputs.attach-pr && needs.check-for-secrets.output.has-github-secret == 'true' && github.actor != 'dependabot[bot]'
steps:
- name: Create pull request attachments
uses: Asana/[email protected]
Expand Down