Proposal: do not run the action job if no Asana URL in the PR description.
I propose the action example to have a condition not to run the job if PR description does not contain Asana URL.
Adding a condition to job if: contains(github.event.pull_request.body, 'https://app.asana.com')
on:
pull_request:
types: [opened, reopened]
jobs:
create-asana-attachment-job:
if: contains(github.event.pull_request.body, 'https://app.asana.com') # Run job only if Asana link in the PR-s description
runs-on: ubuntu-latest
name: Create pull request attachments on Asana tasks
steps:
- name: Create pull request attachments
uses: Asana/create-app-attachment-github-action@latest
id: postAttachment
with:
asana-secret: ${{ secrets.ASANA_SECRET }}
- name: Log output status
run: echo "Status is ${{ steps.postAttachment.outputs.status }}"
This way the action does not run if there's no actual need and doesn't spend action runner minutes.
+1
other issue I encounter is dependabot PR is failing because dependabot doesn't have access to secret
Agree. My only issue with this is that according to Github docs:
A job that is skipped will report its status as "Success". It will not prevent a pull request from merging, even if it is a required check.
What I'd like to see in the example is a way to avoid running when the Asana task URL is missing but also an option to fail the whole job in order to prevent the merge.