Skip to content

Commit

Permalink
Dependencies: Upgrade @octokit/webhooks (#62666)
Browse files Browse the repository at this point in the history
Upgrade @octokit/webhooks package. This fixes a dependabot security alert. It is uprgraded to the minimum version to fix the alert.

Upgrade @octokit/webhooks-types to align with @octokit/webhooks.

---

Co-authored-by: sirreal <[email protected]>
Co-authored-by: youknowriad <[email protected]>
  • Loading branch information
3 people committed Jun 20, 2024
1 parent 8b713db commit 0b97965
Show file tree
Hide file tree
Showing 9 changed files with 126 additions and 59 deletions.
113 changes: 88 additions & 25 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
"@geometricpanda/storybook-addon-badges": "2.0.1",
"@octokit/rest": "16.26.0",
"@octokit/types": "6.34.0",
"@octokit/webhooks-types": "5.6.0",
"@octokit/webhooks-types": "5.8.0",
"@playwright/test": "1.43.0",
"@pmmmwh/react-refresh-webpack-plugin": "0.5.11",
"@react-native/babel-preset": "0.73.10",
Expand Down
4 changes: 4 additions & 0 deletions packages/project-management-automation/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Internal

- Upgrade `@octokit/webhooks` dependency ([#62666](https://github.com/WordPress/gutenberg/pull/62666)).

## 2.1.0 (2024-06-15)

## 2.0.0 (2024-05-31)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const getAssociatedPullRequest = require( '../../get-associated-pull-request' );

/** @typedef {import('@octokit/request-error').RequestError} RequestError */
/** @typedef {ReturnType<import('@actions/github').getOctokit>} GitHub */
/** @typedef {import('@octokit/webhooks').WebhookPayloadPush} WebhookPayloadPush */
/** @typedef {import('@octokit/webhooks-types').EventPayloadMap['push']} WebhookPayloadPush */

/**
* Number of expected days elapsed between releases.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
const debug = require( '../../debug' );

/** @typedef {ReturnType<import('@actions/github').getOctokit>} GitHub */
/** @typedef {import('@octokit/webhooks').WebhookPayloadPullRequest} WebhookPayloadPullRequest */
/** @typedef {import('@octokit/webhooks-types').EventPayloadMap['pull_request']} WebhookPayloadPullRequest */

/**
* Assigns any issues 'fixed' by a newly opened PR to the author of that PR.
Expand All @@ -17,30 +17,33 @@ async function assignFixedIssues( payload, octokit ) {
/(?:close|closes|closed|fix|fixes|fixed|resolve|resolves|resolved):? +(?:\#?|https?:\/\/github\.com\/WordPress\/gutenberg\/issues\/)(\d+)/gi;

let match;
while ( ( match = regex.exec( payload.pull_request.body ) ) ) {
const [ , issue ] = match;

debug(
`assign-fixed-issues: Assigning issue #${ issue } to @${ payload.pull_request.user.login }`
);

await octokit.rest.issues.addAssignees( {
owner: payload.repository.owner.login,
repo: payload.repository.name,
issue_number: +issue,
assignees: [ payload.pull_request.user.login ],
} );

debug(
`assign-fixed-issues: Applying '[Status] In Progress' label to issue #${ issue }`
);

await octokit.rest.issues.addLabels( {
owner: payload.repository.owner.login,
repo: payload.repository.name,
issue_number: +issue,
labels: [ '[Status] In Progress' ],
} );

if ( payload.pull_request.body ) {
while ( ( match = regex.exec( payload.pull_request.body ) ) ) {
const [ , issue ] = match;

debug(
`assign-fixed-issues: Assigning issue #${ issue } to @${ payload.pull_request.user.login }`
);

await octokit.rest.issues.addAssignees( {
owner: payload.repository.owner.login,
repo: payload.repository.name,
issue_number: +issue,
assignees: [ payload.pull_request.user.login ],
} );

debug(
`assign-fixed-issues: Applying '[Status] In Progress' label to issue #${ issue }`
);

await octokit.rest.issues.addLabels( {
owner: payload.repository.owner.login,
repo: payload.repository.name,
issue_number: +issue,
labels: [ '[Status] In Progress' ],
} );
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const getAssociatedPullRequest = require( '../../get-associated-pull-request' );
const hasWordPressProfile = require( '../../has-wordpress-profile' );

/** @typedef {ReturnType<import('@actions/github').getOctokit>} GitHub */
/** @typedef {import('@octokit/webhooks').WebhookPayloadPush} WebhookPayloadPush */
/** @typedef {import('@octokit/webhooks-types').EventPayloadMap['push']} WebhookPayloadPush */
/** @typedef {import('../../get-associated-pull-request').WebhookPayloadPushCommit} WebhookPayloadPushCommit */

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
const debug = require( '../../debug' );

/** @typedef {ReturnType<import('@actions/github').getOctokit>} GitHub */
/** @typedef {import('@octokit/webhooks').WebhookPayloadPullRequest} WebhookPayloadPullRequest */
/** @typedef {import('@octokit/webhooks-types').EventPayloadMap['pull_request']} WebhookPayloadPullRequest */

/**
* Assigns the first-time contributor label to PRs.
Expand Down
2 changes: 1 addition & 1 deletion packages/project-management-automation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@actions/github": "^5.0.0",
"@babel/runtime": "^7.16.0",
"@octokit/request-error": "^2.1.0",
"@octokit/webhooks": "7.1.0"
"@octokit/webhooks": "^9.26.3"
},
"publishConfig": {
"access": "public"
Expand Down
5 changes: 1 addition & 4 deletions packages/project-management-automation/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
"compilerOptions": {
"rootDir": "lib",
"declarationDir": "build-types",
"types": [ "node" ],

// This is required due to a type error coming from missing types in @actions/github
"noImplicitAny": false
"types": [ "node" ]
},
"include": [ "lib/**/*" ]
}

1 comment on commit 0b97965

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 0b97965.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/9596748705
📝 Reported issues:

Please sign in to comment.