[{"id":"githubactionsadvanced-001","courseId":"github-actions-advanced","domain":"workflow-runs-and-triggers","topic":"cancel-in-progress cancels running runs","prompt":"A workflow groups runs by branch and sets cancel-in-progress to !contains(github.ref, 'release/'). Several pushes land on release/1.2.3 while a run is still going. What happens to that run?","hint":"Work out what the cancel-in-progress expression returns for a ref that contains release/.","explain":"A concurrency group allows at most one running run at a time. A separate setting decides whether a new run cancels the one already running, and that setting can be a conditional expression.","source":"https://docs.github.com/en/actions/how-tos/write-workflows/choose-when-workflows-run/control-workflow-concurrency","interaction":{"type":"single"},"options":[{"id":"a","text":"It is cancelled as soon as the second push arrives, like any other run in the group.","whyNot":"A run already in progress is cancelled only when cancel-in-progress is true for the new run's push."},{"id":"b","text":"The workflow fails validation, because cancel-in-progress cannot be an expression.","whyNot":"cancel-in-progress can be an expression built from the allowed contexts, so this file is valid."},{"id":"c","text":"It keeps running to completion, because pushes on release branches do not cancel it.","why":"The expression is false for release/ refs, so pushes there do not cancel runs already in progress."},{"id":"d","text":"The newest push is cancelled while the older run carries on.","whyNot":"A newly queued run waits as pending; it is not cancelled just because an older run is still going."}],"answer":"c","explanation":"cancel-in-progress can be an expression. When it evaluates to false for a push, that push does not cancel runs already in progress in the group.","concept":"cancel-in-progress can be an expression. When it evaluates to false for a push, that push does not cancel runs already in progress in the group.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","takeaways":["cancel-in-progress can be a conditional expression, so one workflow can cancel on some branches and not others."]},{"id":"githubactionsadvanced-002","courseId":"github-actions-advanced","domain":"workflow-runs-and-triggers","topic":"Concurrency pending queue limit","prompt":"A deploy workflow sets queue: max on its concurrency group. Which TWO statements about how its queue behaves are correct?","hint":"Compare how many runs can wait under the default setting with the max setting.","explain":"A concurrency group can hold waiting runs as well as the one running. The queue property sets how many runs may wait and what happens to the rest.","source":"https://docs.github.com/en/actions/how-tos/write-workflows/choose-when-workflows-run/control-workflow-concurrency","interaction":{"type":"multiple","tellCount":true},"options":[{"id":"a","text":"A new run that enters the queue cancels the run already in progress.","whyNot":"With queue: max and no cancel-in-progress, the run in progress is left alone and new runs wait."},{"id":"b","text":"Up to 100 runs can wait pending, and any run beyond that limit is cancelled.","why":"queue: max holds up to 100 pending runs; once the queue is full, additional runs are canceled."},{"id":"c","text":"Waiting runs are ordered by the time they were dispatched, not when they began waiting.","whyNot":"Ordering follows the time each run started waiting on the concurrency group, not its dispatch time."},{"id":"d","text":"The queue has no size limit, so no waiting run is ever cancelled.","whyNot":"queue: max caps the queue at 100 pending runs, and runs past that cap are canceled."},{"id":"e","text":"Only the most recent run waits, and older pending runs are cancelled as new ones arrive.","whyNot":"That replacement is the default single queue; queue: max lets up to 100 runs wait instead."},{"id":"f","text":"Adding cancel-in-progress: true to the same group is rejected at workflow validation.","why":"The two options describe conflicting behavior, so combining them is a validation error."}],"answer":"bf","explanation":"With queue: max, up to 100 runs can wait in a concurrency group and extra runs are canceled; it cannot be combined with cancel-in-progress: true.","concept":"With queue: max, up to 100 runs can wait in a concurrency group and extra runs are canceled; it cannot be combined with cancel-in-progress: true.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","takeaways":["queue: max holds up to 100 waiting runs and cannot be combined with cancel-in-progress: true."]},{"id":"githubactionsadvanced-003","courseId":"github-actions-advanced","domain":"workflow-runs-and-triggers","topic":"always() jobs survive cancellation","prompt":"A workflow has a cleanup job with if: always(). A teammate cancels the run while the cleanup job is still running. What happens to the cleanup job?","hint":"Look at what the job's if: condition evaluates to when the run is being cancelled.","explain":"Cancelling a run is not a blanket stop for every job. The server checks each running job's condition, so an if: expression on a job can decide whether that job is cancelled.","source":"https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-cancellation","interaction":{"type":"single"},"options":[{"id":"a","text":"It is cancelled at once, because cancelling a run stops every job in it.","whyNot":"Cancellation is decided job by job, and a job whose condition is true is left running."},{"id":"b","text":"It keeps running, because its condition is still true when the server re-evaluates it.","why":"The server cancels only jobs whose conditions are not true, and always() evaluates to true."},{"id":"c","text":"It is cancelled, but its always() steps still run after the cancel.","whyNot":"A job being cancelled receives the cancel message; only jobs that keep running have their unfinished steps re-checked."},{"id":"d","text":"It is cancelled only if its first step has not started yet.","whyNot":"Whether a job is cancelled depends on its condition, not on how far its steps have got."}],"answer":"b","explanation":"On cancellation the server re-evaluates each running job's condition; a job whose condition is true, such as one with if: always(), is not cancelled.","concept":"On cancellation the server re-evaluates each running job's condition; a job whose condition is true, such as one with if: always(), is not cancelled.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","takeaways":["Put if: always() on a job only when it must keep running after a cancel."]},{"id":"githubactionsadvanced-004","courseId":"github-actions-advanced","domain":"workflow-runs-and-triggers","topic":"Step cancellation signal sequence","prompt":"A step runs a long script, and its run is cancelled. Put these actions the runner takes on the step's process, in the order the runner takes them.","hint":"Think about giving a process a chance to exit cleanly before forcing it.","explain":"Cancelling a step is not one instant kill. The runner uses time limits to give a process a chance to exit cleanly, and it only forces the process when those limits pass.","source":"https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-cancellation","interaction":{"type":"sort","items":[{"text":"Send SIGINT (Ctrl-C) to the step's entry process.","why":"The first action is the gentlest signal, asking the process to exit cleanly."},{"text":"If it is still running after 7500 ms, send SIGTERM.","why":"SIGTERM follows only after the first signal has had 7500 ms to work."},{"text":"Wait 2500 ms for the process to exit.","why":"This short final window gives the process a chance to exit after SIGTERM."},{"text":"If it is still running, kill the whole process tree.","why":"Killing the tree is the last resort, used only after the signals and waits have failed."}]},"options":[],"answer":"o:abcd","explanation":"A cancelled step gets SIGINT; if it is still running after 7500 ms the runner sends SIGTERM, waits 2500 ms, then kills the process tree.","concept":"A cancelled step gets SIGINT; if it is still running after 7500 ms the runner sends SIGTERM, waits 2500 ms, then kills the process tree.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","takeaways":["A step that ignores SIGINT is still killed if it outlives the 7500 ms and 2500 ms waits."]},{"id":"githubactionsadvanced-005","courseId":"github-actions-advanced","domain":"workflow-runs-and-triggers","topic":"workflow_run branch filter","prompt":"In a workflow_run trigger that sets branches: ['releases/**'], the filter is matched against the branch where this workflow file is stored.","hint":"Think about which workflow run the branches filter is matching against.","explain":"Branch filters limit which events can start a workflow. With some triggers, the event comes from another workflow's run, and a filter can match details of that run.","source":"https://docs.github.com/en/actions/how-tos/write-workflows/choose-when-workflows-run/trigger-a-workflow","interaction":{"type":"true-false"},"options":[{"id":"a","text":"True","whyNot":"The filter matches the branch the triggering workflow ran on, not the branch that holds this file."},{"id":"b","text":"False","why":"branches names the branches of the triggering workflow, so the branch of this file is not what gets checked."}],"answer":"b","explanation":"For workflow_run, the branches filter matches the branch the triggering workflow ran on; it does not check the branch that holds the workflow file.","concept":"For workflow_run, the branches filter matches the branch the triggering workflow ran on; it does not check the branch that holds the workflow file.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","code":"on:\n  workflow_run:\n    workflows: [\"Build\"]\n    types: [requested]\n    branches: ['releases/**']","takeaways":["On workflow_run, read branches as the triggering run's branch, not the branch of this file."]}]