GH-500 practice question 5 of 15
– [Configure GitHub Actions Workflows] 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.) on: pull_request: branches: [main]
Full set: 75 questionsTo prevent a GitHub Actions workflow from running on a pull request when only specific file types are changed, you use the paths-ignore filter. This key is nested under the event trigger, in this case, pullrequest. The paths-ignore key accepts a list of file path patterns. The workflow will not run if all changed files in the pull request match at least one of the patterns in this list. The options '/.md' and '/.txt' specify patterns to ignore markdown and text files in the root directory, respectively.
C. paths: This key is used to include paths. The workflow would only run if changes occurred in the specified paths, which is the opposite of the desired behavior.
E. - 'docs/.md': This pattern is too specific. It would only ignore markdown files within the docs directory, failing to meet the requirement to ignore any markdown file.
1. GitHub Docs
"Workflow syntax for GitHub Actions": Under the section on..paths-ignore
the documentation states: "When you use paths-ignore
the workflow will not run if the only changed files match at least one of the paths-ignore patterns." This confirms the use of paths-ignore to exclude file patterns from triggering a workflow. The examples provided show the list format using hyphens (-).
Reference Location: on > on.. > on..paths-ignore
2. GitHub Docs
"Events that trigger workflows": In the section for the pullrequest event
the documentation details the available filters
including branches
paths
and paths-ignore. It clarifies that paths and paths-ignore are mutually exclusive and cannot be used in the same trigger configuration.
Reference Location: Events that trigger workflows > pullrequest > Using filters
Keep practicing
Take the free GH-500 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other GH-500 practice questions
- Question 1– [Configure and Use Secret Scanning] Secret scanning will scan:
- Question 2– [Use Code Scanning with CodeQL] Why should you dismiss a code scanning alert?
- Question 3– [Configure and Use Secret Scanning] A secret scanning alert should be closed as "used i…
- Question 4– [Configure and Use Dependency Management] Which of the following formats are used to de…
- Question 6– [Describe GitHub Advanced Security Best Practices] Which of the following benefits do c…
- Question 7– [Configure and Use Dependency Management] Which security feature shows a vulnerable dep…
