Files
woodpecker/server/forge/github/fixtures/hooks.go
Robert Kaussow dd06fbcc61 Switch to GitHub REST API to load changed files (#5618)
Co-authored-by: 6543 <6543@obermui.de>

```
// GitHub has removed commit summaries from Events API payloads from 7th October 2025 onwards.
```

- switch to rest api to load changed files
- added some small wording/var name adjustment
- added test cases using GitHub mock client
2025-10-10 14:19:41 +02:00

109 lines
2.9 KiB
Go

// Copyright 2018 Drone.IO Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package fixtures
import _ "embed"
// HookPush is a sample push hook.
// https://developer.github.com/v3/activity/events/types/#pushevent
//
//go:embed HookPush.json
var HookPush string
// HookPushDeleted is a sample push hook that is marked as deleted, and is expected to be ignored.
const HookPushDeleted = `
{
"deleted": true
}
`
// HookPullRequest is a sample hook pull request
// https://developer.github.com/v3/activity/events/types/#pullrequestevent
//
//go:embed HookPullRequest.json
var HookPullRequest string
// HookPullRequestInvalidAction is a sample hook pull request that has an
// action not equal to synchronize or opened, and is expected to be ignored.
const HookPullRequestInvalidAction = `
{
"action": "reopened",
"number": 1
}
`
// HookPullRequestInvalidState is a sample hook pull request that has a state
// not equal to open, and is expected to be ignored.
const HookPullRequestInvalidState = `
{
"action": "synchronize",
"pull_request": {
"number": 1,
"state": "closed"
}
}
`
// HookPush is a sample deployment hook.
// https://developer.github.com/v3/activity/events/types/#deploymentevent
//
//go:embed HookDeploy.json
var HookDeploy string
//go:embed HookPullRequestMerged.json
var HookPullRequestMerged string
// HookPullRequest is a sample hook pull request
// https://developer.github.com/v3/activity/events/types/#pullrequestevent
//
//go:embed HookPullRequestClosed.json
var HookPullRequestClosed string
//go:embed HookPullRequestEdited.json
var HookPullRequestEdited string
//go:embed HookRelease.json
var HookRelease string
//go:embed HookTag.json
var HookTag string
//go:embed HookPullRequestReviewRequested.json
var HookPullRequestReviewRequested string
//go:embed HookPullRequestMilestoneAdded.json
var HookPullRequestMilestoneAdded string
//go:embed HookPullRequestMilestoneRemoved.json
var HookPullRequestMilestoneRemoved string
//go:embed HookPullRequestLabelAdded.json
var HookPullRequestLabelAdded string
//go:embed HookPullRequestLabelRemoved.json
var HookPullRequestLabelRemoved string
//go:embed HookPullRequestAssigneeAdded.json
var HookPullRequestAssigneeAdded string
//go:embed HookPullRequestAssigneeRemoved.json
var HookPullRequestAssigneeRemoved string
//go:embed HookPullRequestReopened.json
var HookPullRequestReopened string
//go:embed HookPullRequestLabelsCleared.json
var HookPullRequestLabelsCleared string