Bump nginx from 1.27.3-bookworm to 1.27.4-bookworm in /nginx #23
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Auto-Merge Dependabot PRs | |
| on: | |
| pull_request: | |
| types: [opened, reopened, labeled, synchronize] | |
| jobs: | |
| auto-merge: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check if PR is eligible for auto-merge | |
| id: check | |
| uses: actions/github-script@v6 | |
| with: | |
| script: | | |
| const prNumber = context.payload.pull_request.number; | |
| const { data: pr } = await github.rest.pulls.get({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| pull_number: prNumber | |
| }); | |
| // Only proceed if the PR is created by Dependabot. | |
| if (pr.user.login !== 'dependabot[bot]') { | |
| core.info("PR is not from Dependabot. Skipping auto-merge."); | |
| core.setOutput("shouldMerge", "false"); | |
| return; | |
| } | |
| // Check if the PR has the 'automerge' label. | |
| const labels = pr.labels.map(label => label.name); | |
| if (!labels.includes('automerge')) { | |
| core.info("PR does not have the 'automerge' label. Skipping auto-merge."); | |
| core.setOutput("shouldMerge", "false"); | |
| return; | |
| } | |
| // Retrieve the combined status for the PR's latest commit. | |
| const { data: combinedStatus } = await github.rest.repos.getCombinedStatusForRef({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| ref: pr.head.sha | |
| }); | |
| core.info(`Combined status state: ${combinedStatus.state}`); | |
| // Only merge if all status checks have passed. | |
| if (combinedStatus.state !== 'success') { | |
| core.info("Not all status checks have passed. Skipping auto-merge."); | |
| core.setOutput("shouldMerge", "false"); | |
| return; | |
| } | |
| core.info("All conditions met. PR is eligible for auto-merge."); | |
| core.setOutput("shouldMerge", "true"); | |
| result-encoding: string | |
| - name: Wait for checks to pass | |
| if: steps.check.outputs.shouldMerge == 'true' | |
| uses: actions/github-script@v6 | |
| with: | |
| script: | | |
| const prNumber = context.payload.pull_request.number; | |
| const { data: pr } = await github.rest.pulls.get({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| pull_number: prNumber | |
| }); | |
| // Wait for status checks to pass. | |
| let checksPending = true; | |
| let retries = 0; | |
| const maxRetries = 20; | |
| const waitTime = 30000; | |
| while (checksPending && retries < maxRetries) { | |
| const { data: combinedStatus } = await github.rest.repos.getCombinedStatusForRef({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| ref: pr.head.sha | |
| }); | |
| if (combinedStatus.state === 'success') { | |
| checksPending = false; | |
| } else { | |
| core.info(`Checks still pending. Waiting... (${retries + 1}/${maxRetries})`); | |
| await new Promise(resolve => setTimeout(resolve, waitTime)); | |
| retries++; | |
| } | |
| } | |
| if (checksPending) { | |
| throw new Error("Checks did not complete successfully within the time limit."); | |
| } | |
| core.info("All checks passed."); | |
| - name: Auto-Merge PR | |
| if: steps.check.outputs.shouldMerge == 'true' | |
| uses: actions/github-script@v6 | |
| with: | |
| script: | | |
| const prNumber = context.payload.pull_request.number; | |
| const mergeResponse = await github.rest.pulls.merge({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| pull_number: prNumber, | |
| merge_method: "squash" | |
| }); | |
| core.info(`Merge response: ${JSON.stringify(mergeResponse.data)}`); |