Skip to content

Commit

Permalink
address review comments
Browse files Browse the repository at this point in the history
Signed-off-by: TomeHirata <tomu.hirata@gmail.com>
  • Loading branch information
TomeHirata committed Nov 1, 2023
1 parent e3c850b commit 9ca5fc6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/auto-merge.js
Expand Up @@ -47,8 +47,8 @@ module.exports = async ({ github, context }) => {
repo,
ref: sha,
});
return checkRuns.check_runs.every(
(run) => run.conclusion === "success" || run.conclusion === "skipped"
return checkRuns.check_runs.every(({ conclusion }) =>
["success", "skipped"].includes(conclusion)
);
}

Expand All @@ -71,7 +71,7 @@ module.exports = async ({ github, context }) => {
for (const pr of pullRequests) {
const pullRequest = await fetchPullRequestDetails(pr.number);

if (!pullRequest || pullRequest.mergeable !== true) {
if (!pullRequest?.mergeable) {
console.log(
`PR #${pr.number} is not mergeable or could not fetch details. Skipping this PR.`
);
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/auto-merge.yml
@@ -1,4 +1,4 @@
name: Automerge PRs
name: Automerge

on:
schedule:
Expand All @@ -9,14 +9,12 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Automerge PRs with "automerge" label created within the last month and are mergeable
- uses: actions/checkout@v4
- name: Automerge
uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
retries: 3
script: |
const script = require('..github/workflows/auto-merge.js');
const script = require('./.github/workflows/auto-merge.js');
await script({github, context});
10 changes: 5 additions & 5 deletions .github/workflows/remove-automerge-label.yml
@@ -1,17 +1,17 @@
name: Remove Auto-Merge Label on New Commit
name: Remove automerge label

on:
pull_request:
pull_request_target:
types:
- synchronize

jobs:
remove-label:
runs-on: ubuntu-latest
if: ${{ !contains(fromJSON('["OWNER", "COLLABORATOR"]'), github.event.pull_request.author_association )}}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Remove specific label
- uses: actions/checkout@v4
- name: Remove automerge label
uses: actions/github-script@v5
with:
github-token: ${{secrets.GITHUB_TOKEN}}
Expand Down

0 comments on commit 9ca5fc6

Please sign in to comment.