chore(deps): update actions/setup-node action to v4 #7
Workflow file for this run
This file contains 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 PRs | |
on: | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- reopened | |
jobs: | |
auto-merge: | |
runs-on: ubuntu-latest | |
if: | | |
github.actor == 'dependabot[bot]' || | |
github.actor == 'OCEANOFANYTHINGOFFICIAL' || | |
github.actor == 'DIPRAGHOSH2006' || | |
github.actor == 'dawidprofo' || | |
github.actor == 'renovate[bot]' | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Wait for CI checks to pass | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const { github, context } = require('@actions/github'); | |
const pullRequestSha = context.payload.pull_request.head.sha; | |
async function checkCI() { | |
try { | |
const { data: checkRuns } = await github.checks.listForRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: pullRequestSha, | |
}); | |
const allChecksPassed = checkRuns.check_runs.every(run => run.conclusion === 'success'); | |
if (!allChecksPassed) { | |
throw new Error('Not all CI checks have passed.'); | |
} | |
} catch (error) { | |
console.error(error); | |
process.exit(1); | |
} | |
} | |
checkCI(); | |
- name: Automatically merge PRs | |
run: | | |
gh pr merge ${{ github.event.pull_request.number }} --auto --squash --message "chore: ${{ github.event.pull_request.title }}" --delete-branch | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |