nerdexam
Microsoft

GH-500 · Question #59

As a repository owner, you do not want to run a GitHub Actions workflow when changes are made to any .txt or markdown files. How would you adjust the event trigger for a pull request that targets…

The correct answer is A. paths-ignore: C. - '**/*.md' D. - '**/*.txt'. To skip workflow runs when only .txt or markdown files change, you use (A) paths-ignore: under the pull_request trigger, then list (C) - '*/.md' and (D) - '*/.txt' as glob patterns to exclude. The paths-ignore key tells GitHub Actions to skip the workflow if ALL changed files…

Introduction to GitHub Advanced Security

Question

As a repository owner, you do not want to run a GitHub Actions workflow when changes are made to any .txt or markdown files. How would you adjust the event trigger for a pull request that targets the main branch? Each answer presents part of the solution. (Choose three.) 1. on: 2. push: 3. branches: [main, protected] 4. pull_request: 5. branches: [main]

Options

  • Apaths-ignore:
  • Bpaths:
  • C
    • '**/*.md'
  • D
    • '**/*.txt'
  • E
    • '/docs/.md'

How the community answered

(62 responses)
  • A
    82% (51)
  • B
    13% (8)
  • E
    5% (3)

Explanation

To skip workflow runs when only .txt or markdown files change, you use (A) paths-ignore: under the pull_request trigger, then list (C) - '**/*.md' and (D) - '**/*.txt' as glob patterns to exclude. The paths-ignore key tells GitHub Actions to skip the workflow if ALL changed files match the listed patterns. Using paths: (B) does the opposite - it only runs when matching files change. The pattern - '*/docs/*.md' (E) is too narrow and only matches markdown files one level inside a docs folder.

Topics

#GitHub Actions#Workflow Triggers#YAML#File Filtering

Community Discussion

No community discussion yet for this question.

Full GH-500 Practice