While awaiting approval, how many days can a workflow be in the “Waiting” state before it automatically fails?
Answer(s): A
Using required reviews in workflowsJobs that reference an environment configured with required reviewers will wait for an approval before starting. While a job is awaiting approval, it has a status of "Waiting". If a job is not approved within 30 days, it will automatically fail.
https://docs.github.com/en/actions/how-tos/deploy/configure-and-manage-deployments/control-deployments
As a developer, what is the safest way to reference an action to prevent modification of the underlying code?
The safest way to reference a GitHub Action to prevent any modification of its underlying code is to pin the action to a full-length, 40-character commit SHA (hash).Unlike tags or branch names, a commit SHA is strictly immutable in Git. This prevents malicious actors or developers from pushing silent updates, changing a release tag, or tampering with the code executing in your pipeline.Secure Reference SyntaxWhen using a commit SHA, append a human-readable comment with the semantic version tag. This practice ensures your workflows remain easily auditable by your team.steps:- name: Checkout code uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
https://github.com/github/awesome-copilot/blob/main/instructions/github-actions-ci-cd-best-practices.instruction s.md
In which scenarios could the GITHUB_TOKEN be used? (Each correct answer presents a complete solution. Choose two.)
Answer(s): D,E
[D] To authenticate to a GitHub Packages registry within a GitHub Actions workflow, you can use:*-> GITHUB_TOKEN to publish packages associated with the workflow repository.* A personal access token (classic) with at least read:packages scope to install packages associated with other private repositories (GITHUB_TOKEN can be used if the repository is granted read access to the package.[E] You can use the GITHUB_TOKEN to make authenticated API calls. This example workflow creates an issue using the GitHub REST API:name: Create issue on commit on: [ push ]jobs:create_issue:runs-on: ubuntu-latest permissions:issues: write steps:- name: Create issue using REST APIrun: |curl --request POST \--url https://api.github.com/repos/${{ github.repository }}/issues \--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \--header 'content-type: application/json' \--data '{"title": "Automated issue for commit: ${{ github.sha }}","body": "This issue was automatically created by the GitHub Action workflow **${{ github.workflow }}**. \n\n The commit hash was: _${{ github.sha }}_."}' \--failIncorrect:[Not A] The secrets API requires the secrets permission, which is not available in an Actions workflow via the GITHUB_TOKEN.[Not B] The token cannot be given organization-scoped permissions. The scope is relatively limited.
https://docs.github.com/en/packages/learn-github-packages/introduction-to-github-packages https://docs.github.com/en/actions/tutorials/authenticate-with-github_token
HOTSPOT (Drag and Drop is not supported)You have a GitHub repository that contains a Node.js project and a local action named Action1. Multiple jobs in repository workflows call Action1. Action1 installs dependencies, runs tests, and returns a generated report path to the calling workflows.You need to ensure that Action1 meets the following requirements:● Encapsulates multiple workflow steps without packaging a separate runtime● Exposes the report path produced by the test stepHow should you complete the metadata file? To answer, select the appropriate options in the answer area.Note: Each correct selection is worth one point.Hot Area:
Box 1: composite composite allows an action to execute multiple workflow steps without requiring a separate runtime or Docker container.Box 2: ${{ steps.test.outputs.report-path }}${{ steps.test.outputs.report-path }} retrieves the report-path output generated by the step with id: test. The test step writes the output to $GITHUB_OUTPUT, making it available to the calling workflow through the composite action's output mapping.
You are a developer working on developing reusable workflows for your organization. What keyword should be included as part of the reusable workflow event triggers?
Answer(s): C
To make a GitHub Actions workflow reusable, you must include the workflow_call keyword under the on key.This specific event trigger allows the workflow to be called by other "caller" workflows rather than only triggering on standard events like a code push or pull request.Reusable Workflow SyntaxA basic reusable workflow structure using the workflow_call trigger typically looks like this:on:workflow_call:inputs:# Optional: Define inputs to be passed from the caller username:required: true type: string secrets:# Optional: Define secrets to be passed from the caller env_token:required: trueKey Components of workflow_call inputs: Used to define non-sensitive data (strings, numbers, or booleans) that the caller workflow must or can provide.secrets: Used to define sensitive data that the caller must pass to the reusable workflow.outputs: Used to map data from jobs within the reusable workflow so they can be used by the caller workflow.
https://www.incredibuild.com/blog/best-practices-to-create-reusable-workflows-on-github-actions
Post your Comments and Discuss Microsoft GH-200 exam prep with other Community members:
Our website is free, but we have to fight against AI bots and content theft. We're sorry for the inconvenience caused by these security measures. You can access the rest of the GH-200 content, but please register or login to continue.