Skip to content

Commit

Permalink
Use default token (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
tibdex authored Oct 16, 2022
1 parent 6923e6a commit 8cf02f8
Show file tree
Hide file tree
Showing 5 changed files with 566 additions and 525 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Install
run: yarn install --frozen-lockfile
- name: Deduplicate dependencies
run: yarn run yarn-deduplicate --fail
run: yarn run yarn-deduplicate --fail --strategy fewer
- name: Build
run: yarn run build
- name: Format
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Automatically keep pull requests with auto-merged enabled up to dat
inputs:
github_token:
description: Token for the GitHub API.
required: true
default: ${{ github.token }}
runs:
using: node16
main: dist/index.js
Expand Down
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "auto-update",
"version": "2.1.5",
"version": "2.2.0",
"license": "MIT",
"type": "module",
"files": [
Expand All @@ -14,23 +14,23 @@
"xo": "xo"
},
"dependencies": {
"@actions/core": "^1.6.0",
"@actions/github": "^5.0.1",
"@actions/core": "^1.10.0",
"@actions/github": "^5.1.1",
"ensure-error": "^4.0.0"
},
"devDependencies": {
"@octokit/openapi-types": "^11.2.0",
"@octokit/plugin-paginate-rest": "^2.17.0",
"@octokit/webhooks-definitions": "^3.67.3",
"@types/node": "^16.11.11",
"@vercel/ncc": "^0.33.3",
"@types/node": "^18.11.0",
"@vercel/ncc": "^0.34.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-sort-destructure-keys": "^1.4.0",
"eslint-plugin-typescript-sort-keys": "^2.1.0",
"prettier": "^2.6.2",
"prettier-plugin-packagejson": "^2.2.17",
"typescript": "^4.7.0-beta",
"xo": "^0.48.0",
"yarn-deduplicate": "^4.0.0"
"prettier": "^2.7.1",
"prettier-plugin-packagejson": "^2.3.0",
"typescript": "^4.8.4",
"xo": "^0.52.4",
"yarn-deduplicate": "^6.0.0"
}
}
11 changes: 7 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import { getInput, group, info, setFailed, warning } from "@actions/core";
import { context, getOctokit } from "@actions/github";
import type { GitHub } from "@actions/github/lib/utils.js";
import type { components } from "@octokit/openapi-types";
import type { PaginatingEndpoints } from "@octokit/plugin-paginate-rest";
import type { PushEvent } from "@octokit/webhooks-definitions/schema.js";
import ensureError from "ensure-error";

const unupdatablePullRequestCommentBody =
"Cannot auto-update because of conflicts.";

type PullRequest =
PaginatingEndpoints["GET /repos/{owner}/{repo}/pulls"]["response"]["data"][number];

const handleUnupdatablePullRequest = async (
pullRequest: components["schemas"]["pull-request-simple"],
pullRequest: PullRequest,
{
octokit,
}: Readonly<{
Expand Down Expand Up @@ -77,7 +80,7 @@ const handleUnupdatablePullRequest = async (
};

const handlePullRequest = async (
pullRequest: components["schemas"]["pull-request-simple"],
pullRequest: PullRequest,
{
eventPayload,
octokit,
Expand Down Expand Up @@ -135,7 +138,7 @@ const run = async () => {

info(`Fetching pull requests based on "${base}"`);

const pullRequests = await octokit.paginate(
const pullRequests: readonly PullRequest[] = await octokit.paginate(
"GET /repos/{owner}/{repo}/pulls",
{
...context.repo,
Expand Down
Loading

0 comments on commit 8cf02f8

Please sign in to comment.