chore(release): teamtalk-macros v0.1.3, teamtalk v7.0.0 #288
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: Dependabot Auto-Merge | |
| on: | |
| pull_request_target: | |
| types: [opened, reopened, synchronize, ready_for_review] | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| automerge: | |
| if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' && github.event.pull_request.draft == false }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Fetch Dependabot metadata | |
| id: metadata | |
| uses: dependabot/fetch-metadata@21025c705c08248db411dc16f3619e6b5f9ea21a # v2.5.0 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Enable auto-merge for patch/minor updates | |
| uses: actions/github-script@v8 | |
| env: | |
| UPDATE_TYPE: ${{ steps.metadata.outputs.update-type }} | |
| with: | |
| script: | | |
| const updateType = process.env.UPDATE_TYPE || ""; | |
| const allowed = [ | |
| "version-update:semver-patch", | |
| "version-update:semver-minor", | |
| ]; | |
| if (!allowed.includes(updateType)) { | |
| core.info(`Skip auto-merge for update type: ${updateType}`); | |
| return; | |
| } | |
| const pullRequestId = context.payload.pull_request.node_id; | |
| const deadline = Date.now() + 10 * 60 * 1000; | |
| while (true) { | |
| try { | |
| await github.graphql( | |
| `mutation($pullRequestId: ID!) { | |
| enablePullRequestAutoMerge(input: {pullRequestId: $pullRequestId, mergeMethod: SQUASH}) { | |
| pullRequest { | |
| number | |
| } | |
| } | |
| }`, | |
| { pullRequestId } | |
| ); | |
| core.info(`Auto-merge enabled for PR #${context.payload.pull_request.number}`); | |
| return; | |
| } catch (error) { | |
| const message = String(error); | |
| if (message.includes("Pull request Auto merge is already enabled")) { | |
| core.info("Auto-merge already enabled."); | |
| return; | |
| } | |
| if (!message.includes("unstable status")) { | |
| throw error; | |
| } | |
| const remainingMs = deadline - Date.now(); | |
| if (remainingMs <= 0) { | |
| throw error; | |
| } | |
| const sleepMs = Math.min(15000, remainingMs); | |
| core.info(`Pull request still unstable; retrying in ${Math.ceil(sleepMs / 1000)}s`); | |
| await new Promise((resolve) => setTimeout(resolve, sleepMs)); | |
| } | |
| } |