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

Add merge_queue setting to repos #7

Open
6 of 30 tasks
laurafitzgerald opened this issue Jan 24, 2025 · 0 comments
Open
6 of 30 tasks

Add merge_queue setting to repos #7

laurafitzgerald opened this issue Jan 24, 2025 · 0 comments
Assignees

Comments

@laurafitzgerald
Copy link

laurafitzgerald commented Jan 24, 2025

Changes Required

Configuration Changes

Under any .github/workflows/ files that contain checks that are required to be retested after addition to the merge queue add the following. Note - if you are not sure which ones, check any that are triggered on.push_request_target: main

Add the following to on

merge_group:
    types: [checks_requested]
workflow_dispatch:

If you are using path_ignores or path to skip jobs based on specified directories or files
Under jobs add the following pre-job to the top of the list of jobs

pre-job:
    runs-on: ubuntu-latest
    name: Pre job checks
    outputs:
      should_skip: ${{ steps.skip_check.outputs.should_skip }}
    steps:
      - uses: actions/checkout@v4
      - id: skip_check
        uses: fkirc/[email protected]
        with:
          cancel_others: false
          paths_ignore: '[<your entries for path_ignores comma separated>]'
          OR
         paths: '[<your entries for path comma separated>]'

Remove the entry for paths_ignores OR path, it is now handled by the pre-job

For each job add the following entry:

    if: needs.pre-job.outputs.should_skip != 'true'
    needs: pre-job

For all workflow files regardless of the use of path_ignore and that contain jobs that need to be retested on addition to the merge queue, to the bottom of the job list add the following:

required-checks:
    name: <Name of Workflow> Required Checks
    # This check adds a list of checks to one job to simplify adding settings to the repo.
    # If a new check is added in this file, and it should be retested on entry to the merge queue,
    # it needs to be added to the list below aka needs: [ existing check 1, existing check 2, new check ].
    needs: [ <your list of checks that should be retested> ]
    if: always()
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: echo '${{ toJSON(needs) }}' | jq -e 'all(.[]; .result == "success" or .result == "skipped")'

Setting Changes

After your pr is merged add the following settings.

Your Repo -> Settings-> Branches -> main -> edit -> Require status checks to pass before merging -> true
-> Status Checks that are required -> Add using the required-checks.name for any that you have added to your workflow files.

It will look something like the following. Pro Tip: search for Required Checks and all your applicable checks should appear in the dropdown
Image

Your Repo -> Settings-> Branches -> main -> edit -> Require merge queue

Image

Repo Checklist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants