create-app-attachment-github-action icon indicating copy to clipboard operation
create-app-attachment-github-action copied to clipboard

Proposal: do not run the action job if no Asana URL in the PR description.

Open lkallas opened this issue 3 years ago • 2 comments

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.

lkallas avatar Sep 07 '22 14:09 lkallas

+1

other issue I encounter is dependabot PR is failing because dependabot doesn't have access to secret

daisy1754 avatar Sep 29 '22 13:09 daisy1754

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.

psypuff avatar Aug 06 '23 11:08 psypuff