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

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

Open
lkallas opened this issue Sep 7, 2022 · 2 comments

Comments

@lkallas
Copy link

lkallas commented Sep 7, 2022

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.

@daisy1754
Copy link

+1

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

@psypuff
Copy link

psypuff commented Aug 6, 2023

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.

digitalcora added a commit to mbta/screens that referenced this issue Mar 21, 2024
Two small changes:

* Add an explicit action version, as the `latest` tag is apparently not
  being updated to consistently point to the actual latest version.

* Add a conditional so the job doesn't attempt to run (and fail) if
  there is no Asana link in the PR. Taken from this suggestion:
  Asana/create-app-attachment-github-action#14
digitalcora added a commit to mbta/screens that referenced this issue Mar 21, 2024
Two small changes:

* Add an explicit action version, as the `latest` tag is apparently not
  being updated to consistently point to the actual latest version.

* Add a conditional so the job doesn't attempt to run (and fail) if
  there is no Asana link in the PR. Taken from this suggestion:
  Asana/create-app-attachment-github-action#14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants