Skip to content

Commit

Permalink
Update GitHub Actions
Browse files Browse the repository at this point in the history
Signed-off-by: Sora Morimoto <[email protected]>
  • Loading branch information
smorimoto committed May 4, 2024
1 parent 3c676d6 commit 7eb0b1f
Showing 1 changed file with 6 additions and 64 deletions.
70 changes: 6 additions & 64 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,81 +14,23 @@ jobs:
- ubuntu-latest
- windows-latest
node-version:
- 16.x
- 18.x
- 20
- 22

runs-on: ${{ matrix.os }}

steps:
- name: Checkout tree
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
- name: Set-up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
check-latest: true

- name: Install npm packages
run: npm ci --ignore-scripts

- name: Run the tests
run: npm run test-all

dependabot-auto-approve:
name: Dependabot auto-approve

permissions:
pull-requests: write

needs:
- build-and-test

if: ${{ github.event_name == 'pull_request' && github.actor == 'dependabot[bot]' }}

runs-on: ubuntu-latest

steps:
- name: Fetch Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1

- name: Get the PR review decision
id: gh-pr-review
run: echo "decision=$(gh pr view --json reviewDecision --jq '. | .reviewDecision' "$PR_URL")" >>"$GITHUB_OUTPUT"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ github.token }}

- name: Approve a PR
if: ${{ steps.gh-pr-review.outputs.decision != 'APPROVED' && steps.metadata.outputs.update-type == 'version-update:semver-patch' }}
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ github.token }}

dependabot-auto-merge:
name: Dependabot auto-merge

permissions:
contents: write
pull-requests: write

if: ${{ github.event_name == 'pull_request' && github.actor == 'dependabot[bot]' }}

needs:
- build-and-test
- dependabot-auto-approve

runs-on: ubuntu-latest

steps:
- name: Fetch Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1

- name: Merge Dependabot PR
if: ${{ steps.metadata.outputs.update-type == 'version-update:semver-patch' }}
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ github.token }}

0 comments on commit 7eb0b1f

Please sign in to comment.