Skip to content

Commit 158a28c

Browse files
authored
Merge pull request #21 from peter-evans/main
Sync main branch with upstream changes
2 parents 6073f54 + 176fdd2 commit 158a28c

15 files changed

+2350
-28335
lines changed

README.md

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Create Pull Request action will:
1515
- tracked (modified) files
1616
- commits made during the workflow that have not been pushed
1717
2. Commit all changes to a new branch, or update an existing pull request branch.
18-
3. Create a pull request to merge the new branch into the base—the branch checked out in the workflow.
18+
3. Create or update a pull request to merge the branch into the base—the branch checked out in the workflow.
1919

2020
## Documentation
2121

@@ -99,7 +99,7 @@ Other token options:
9999
#### branch-token
100100

101101
The action first creates a branch, and then creates a pull request for the branch.
102-
For some rare use cases it can be useful, or even neccessary, to use different tokens for these operations.
102+
For some rare use cases it can be useful, or even necessary, to use different tokens for these operations.
103103
It is not advisable to use this input unless you know you need to.
104104

105105
#### commit-message
@@ -246,26 +246,6 @@ Note that the repository must be checked out on a branch with a remote, it won't
246246
uses: peter-evans/create-pull-request@v7
247247
```
248248

249-
<!--
250-
### Create a project card
251-
252-
To create a project card for the pull request, pass the `pull-request-number` step output to [create-or-update-project-card](https://github.com/peter-evans/create-or-update-project-card) action.
253-
254-
```yml
255-
- name: Create Pull Request
256-
id: cpr
257-
uses: peter-evans/create-pull-request@v7
258-
259-
- name: Create or Update Project Card
260-
if: ${{ steps.cpr.outputs.pull-request-number }}
261-
uses: peter-evans/create-or-update-project-card@v2
262-
with:
263-
project-name: My project
264-
column-name: My column
265-
issue-number: ${{ steps.cpr.outputs.pull-request-number }}
266-
```
267-
-->
268-
269249
### Auto-merge
270250

271251
Auto-merge can be enabled on a pull request allowing it to be automatically merged once requirements have been satisfied.

__test__/create-or-update-branch.int.test.ts

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -250,11 +250,15 @@ describe('create-or-update-branch tests', () => {
250250
expect(branchCommits.length).toEqual(1)
251251
expect(branchCommits[0].subject).toEqual('Test changes')
252252
expect(branchCommits[0].changes.length).toEqual(3)
253-
expect(branchCommits[0].changes).toEqual([
254-
{mode: '100755', path: UNTRACKED_EXE_FILE, status: 'A'},
255-
{mode: '100644', path: TRACKED_FILE, status: 'M'},
256-
{mode: '100644', path: UNTRACKED_FILE, status: 'A'}
257-
])
253+
expect(branchCommits[0].changes[0].mode).toEqual('100755')
254+
expect(branchCommits[0].changes[0].path).toEqual(UNTRACKED_EXE_FILE)
255+
expect(branchCommits[0].changes[0].status).toEqual('A')
256+
expect(branchCommits[0].changes[1].mode).toEqual('100644')
257+
expect(branchCommits[0].changes[1].path).toEqual(TRACKED_FILE)
258+
expect(branchCommits[0].changes[1].status).toEqual('M')
259+
expect(branchCommits[0].changes[2].mode).toEqual('100644')
260+
expect(branchCommits[0].changes[2].path).toEqual(UNTRACKED_FILE)
261+
expect(branchCommits[0].changes[2].status).toEqual('A')
258262
})
259263

260264
it('tests buildBranchCommits with addition and deletion', async () => {
@@ -272,11 +276,15 @@ describe('create-or-update-branch tests', () => {
272276
expect(branchCommits.length).toEqual(1)
273277
expect(branchCommits[0].subject).toEqual('Test changes')
274278
expect(branchCommits[0].changes.length).toEqual(3)
275-
expect(branchCommits[0].changes).toEqual([
276-
{mode: '100644', path: TRACKED_FILE, status: 'D'},
277-
{mode: '100644', path: UNTRACKED_FILE, status: 'A'},
278-
{mode: '100644', path: TRACKED_FILE_NEW_PATH, status: 'A'}
279-
])
279+
expect(branchCommits[0].changes[0].mode).toEqual('100644')
280+
expect(branchCommits[0].changes[0].path).toEqual(TRACKED_FILE)
281+
expect(branchCommits[0].changes[0].status).toEqual('D')
282+
expect(branchCommits[0].changes[1].mode).toEqual('100644')
283+
expect(branchCommits[0].changes[1].path).toEqual(UNTRACKED_FILE)
284+
expect(branchCommits[0].changes[1].status).toEqual('A')
285+
expect(branchCommits[0].changes[2].mode).toEqual('100644')
286+
expect(branchCommits[0].changes[2].path).toEqual(TRACKED_FILE_NEW_PATH)
287+
expect(branchCommits[0].changes[2].status).toEqual('A')
280288
})
281289

282290
it('tests buildBranchCommits with multiple commits', async () => {
@@ -294,10 +302,13 @@ describe('create-or-update-branch tests', () => {
294302
expect(branchCommits[i].subject).toEqual(`Test changes ${i}`)
295303
expect(branchCommits[i].changes.length).toEqual(2)
296304
const untrackedFileStatus = i == 0 ? 'A' : 'M'
297-
expect(branchCommits[i].changes).toEqual([
298-
{mode: '100644', path: TRACKED_FILE, status: 'M'},
299-
{mode: '100644', path: UNTRACKED_FILE, status: untrackedFileStatus}
300-
])
305+
306+
expect(branchCommits[i].changes[0].mode).toEqual('100644')
307+
expect(branchCommits[i].changes[0].path).toEqual(TRACKED_FILE)
308+
expect(branchCommits[i].changes[0].status).toEqual('M')
309+
expect(branchCommits[i].changes[1].mode).toEqual('100644')
310+
expect(branchCommits[i].changes[1].path).toEqual(UNTRACKED_FILE)
311+
expect(branchCommits[i].changes[1].status).toEqual(untrackedFileStatus)
301312
}
302313
})
303314

__test__/entrypoint.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,17 @@ git clone git://127.0.0.1/repos/test-base.git /git/local/repos/test-base
1919
cd /git/local/repos/test-base
2020
git config --global user.email "you@example.com"
2121
git config --global user.name "Your Name"
22-
echo "#test-base" > README.md
22+
echo "#test-base" > README→TEMP.md
2323
git add .
2424
git commit -m "initial commit"
2525
git commit --allow-empty -m "empty commit for tests"
26-
echo "#test-base :sparkles:" > README.md
26+
echo "#test-base :sparkles:" > README→TEMP.md
2727
git add .
2828
git commit -m "add sparkles" -m "Change description:
29-
- updates README.md to add sparkles to the title"
29+
- updates README→TEMP.md to add sparkles to the title"
30+
mv README→TEMP.md README.md
31+
git add .
32+
git commit -m "rename readme"
3033
git push -u
3134
git log -1 --pretty=oneline
3235
git config --global --unset user.email

__test__/git-command-manager.int.test.ts

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,38 @@ describe('git-command-manager integration tests', () => {
1111
})
1212

1313
it('tests getCommit', async () => {
14-
const initialCommit = await git.getCommit('HEAD^^')
15-
const emptyCommit = await git.getCommit('HEAD^')
14+
const initialCommit = await git.getCommit('HEAD^^^')
15+
const emptyCommit = await git.getCommit('HEAD^^')
16+
const modifiedCommit = await git.getCommit('HEAD^')
1617
const headCommit = await git.getCommit('HEAD')
1718

1819
expect(initialCommit.subject).toEqual('initial commit')
1920
expect(initialCommit.signed).toBeFalsy()
20-
expect(initialCommit.changes).toEqual([
21-
{mode: '100644', status: 'A', path: 'README.md'}
22-
])
21+
expect(initialCommit.changes[0].mode).toEqual('100644')
22+
expect(initialCommit.changes[0].status).toEqual('A')
23+
expect(initialCommit.changes[0].path).toEqual('README→TEMP.md') // filename contains unicode
2324

2425
expect(emptyCommit.subject).toEqual('empty commit for tests')
2526
expect(emptyCommit.tree).toEqual(initialCommit.tree) // empty commits have no tree and reference the parent's
2627
expect(emptyCommit.parents[0]).toEqual(initialCommit.sha)
2728
expect(emptyCommit.signed).toBeFalsy()
2829
expect(emptyCommit.changes).toEqual([])
2930

30-
expect(headCommit.subject).toEqual('add sparkles')
31-
expect(headCommit.parents[0]).toEqual(emptyCommit.sha)
31+
expect(modifiedCommit.subject).toEqual('add sparkles')
32+
expect(modifiedCommit.parents[0]).toEqual(emptyCommit.sha)
33+
expect(modifiedCommit.signed).toBeFalsy()
34+
expect(modifiedCommit.changes[0].mode).toEqual('100644')
35+
expect(modifiedCommit.changes[0].status).toEqual('M')
36+
expect(modifiedCommit.changes[0].path).toEqual('README→TEMP.md')
37+
38+
expect(headCommit.subject).toEqual('rename readme')
39+
expect(headCommit.parents[0]).toEqual(modifiedCommit.sha)
3240
expect(headCommit.signed).toBeFalsy()
33-
expect(headCommit.changes).toEqual([
34-
{mode: '100644', status: 'M', path: 'README.md'}
35-
])
41+
expect(headCommit.changes[0].mode).toEqual('100644')
42+
expect(headCommit.changes[0].status).toEqual('A')
43+
expect(headCommit.changes[0].path).toEqual('README.md')
44+
expect(headCommit.changes[1].mode).toEqual('100644')
45+
expect(headCommit.changes[1].status).toEqual('D')
46+
expect(headCommit.changes[1].path).toEqual('README→TEMP.md')
3647
})
3748
})

dist/790.index.js

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)