-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: tagPullRequestNumber option to tag release SHA (#5683)
(Compared to the previous attempt #5682, this version creates the ref in runBranchConfiguration.) With the following lines in release-please.yml file, the bot now can tag the release ``` handleGHRelease: true tagPullRequestNumber: true ``` Test case is in 'should tag pull request number if configured'.
- Loading branch information
Showing
8 changed files
with
220 additions
and
12 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
packages/release-please/test/fixtures/config/manifest_tag_pr_number.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
primaryBranch: master | ||
manifest: true | ||
handleGHRelease: true | ||
tagPullRequestNumber: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Copyright 2025 Google LLC | ||
// | ||
// 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. | ||
|
||
import nock from 'nock'; | ||
import {Runner} from '../src/runner'; | ||
import {Octokit} from '@octokit/rest'; | ||
import assert from 'assert'; | ||
|
||
nock.disableNetConnect(); | ||
|
||
describe('Release Please Runner', () => { | ||
let octokit: Octokit; | ||
beforeEach(() => { | ||
octokit = new Octokit({auth: 'faketoken'}); | ||
}); | ||
afterEach(() => { | ||
nock.cleanAll(); | ||
}); | ||
|
||
it('should create a ref for lightweight tag', async () => { | ||
const requests = nock('https://api.github.com') | ||
.post('/repos/owner1/repo1/git/refs', body => { | ||
assert.equal(body['ref'], 'refs/tags/release-please-123'); | ||
assert.equal(body['sha'], 'abcdefg'); | ||
return true; | ||
}) | ||
.reply(200); | ||
|
||
await Runner.createLightweightTag( | ||
octokit, | ||
{ | ||
owner: 'owner1', | ||
repo: 'repo1', | ||
defaultBranch: 'main', | ||
}, | ||
'release-please-123', | ||
'abcdefg' | ||
); | ||
requests.done(); | ||
}); | ||
}); |