Skip to content

Commit

Permalink
Revert "feat (#2717)"
Browse files Browse the repository at this point in the history
This reverts commit 1232200.
  • Loading branch information
peter-evans committed Jan 31, 2024
1 parent 1232200 commit 3cd226b
Show file tree
Hide file tree
Showing 24 changed files with 490 additions and 619 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Expand Up @@ -22,7 +22,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20.x
node-version: 16.x
cache: npm
- run: npm ci
- run: npm run build
Expand Down Expand Up @@ -68,8 +68,8 @@ jobs:
uses: ./
with:
commit-message: '[CI] test ${{ matrix.target }}'
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
author: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com>
committer: GitHub <noreply@github.com>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
title: '[CI] test ${{ matrix.target }}'
body: |
- CI test case for target '${{ matrix.target }}'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cpr-example-command.yml
Expand Up @@ -16,8 +16,8 @@ jobs:
uses: ./
with:
commit-message: Update report
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
author: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com>
committer: GitHub <noreply@github.com>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
signoff: false
title: '[Example] Update report'
body: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-major-version.yml
Expand Up @@ -11,8 +11,8 @@ on:
type: choice
description: The major version tag to update
options:
- v4
- v5
- v6

jobs:
tag:
Expand Down
27 changes: 13 additions & 14 deletions README.md
Expand Up @@ -21,7 +21,7 @@ Create Pull Request action will:

- [Concepts, guidelines and advanced usage](docs/concepts-guidelines.md)
- [Examples](docs/examples.md)
- [Updating to v6](docs/updating.md)
- [Updating to v5](docs/updating.md)
- [Common issues](docs/common-issues.md)

## Usage
Expand All @@ -32,10 +32,10 @@ Create Pull Request action will:
# Make changes to pull request here

- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
uses: peter-evans/create-pull-request@v5
```

You can also pin to a [specific release](https://github.com/peter-evans/create-pull-request/releases) version in the format `@v6.x.x`
You can also pin to a [specific release](https://github.com/peter-evans/create-pull-request/releases) version in the format `@v5.x.x`

### Workflow permissions

Expand All @@ -53,12 +53,11 @@ All inputs are **optional**. If not set, sensible defaults will be used.
| Name | Description | Default |
| --- | --- | --- |
| `token` | `GITHUB_TOKEN` (permissions `contents: write` and `pull-requests: write`) or a `repo` scoped [Personal Access Token (PAT)](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token). | `GITHUB_TOKEN` |
| `git-token` | The [Personal Access Token (PAT)](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) that the action will use for git operations. | Defaults to the value of `token` |
| `path` | Relative path under `GITHUB_WORKSPACE` to the repository. | `GITHUB_WORKSPACE` |
| `add-paths` | A comma or newline-separated list of file paths to commit. Paths should follow git's [pathspec](https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefpathspecapathspec) syntax. If no paths are specified, all new and modified files are added. See [Add specific paths](#add-specific-paths). | |
| `commit-message` | The message to use when committing changes. See [commit-message](#commit-message). | `[create-pull-request] automated change` |
| `committer` | The committer name and email address in the format `Display Name <email@address.com>`. Defaults to the GitHub Actions bot user. | `github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>` |
| `author` | The author name and email address in the format `Display Name <email@address.com>`. Defaults to the user who triggered the workflow run. | `${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com>` |
| `committer` | The committer name and email address in the format `Display Name <email@address.com>`. Defaults to the GitHub Actions bot user. | `GitHub <noreply@github.com>` |
| `author` | The author name and email address in the format `Display Name <email@address.com>`. Defaults to the user who triggered the workflow run. | `${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>` |
| `signoff` | Add [`Signed-off-by`](https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---signoff) line by the committer at the end of the commit log message. | `false` |
| `branch` | The pull request branch name. | `create-pull-request/patch` |
| `delete-branch` | Delete the `branch` if it doesn't have an active pull request associated with it. See [delete-branch](#delete-branch). | `false` |
Expand Down Expand Up @@ -100,7 +99,7 @@ If you want branches to be deleted immediately on merge then you should use GitH
For self-hosted runners behind a corporate proxy set the `https_proxy` environment variable.
```yml
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
uses: peter-evans/create-pull-request@v5
env:
https_proxy: http://<proxy_address>:<port>
```
Expand All @@ -120,7 +119,7 @@ Note that in order to read the step outputs the action step must have an id.
```yml
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v6
uses: peter-evans/create-pull-request@v5
- name: Check outputs
if: ${{ steps.cpr.outputs.pull-request-number }}
run: |
Expand Down Expand Up @@ -183,7 +182,7 @@ File changes that do not match one of the paths will be stashed and restored aft

```yml
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
uses: peter-evans/create-pull-request@v5
with:
add-paths: |
*.java
Expand All @@ -210,7 +209,7 @@ Note that the repository must be checked out on a branch with a remote, it won't
- name: Uncommitted change
run: date +%s > report.txt
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
uses: peter-evans/create-pull-request@v5
```

### Create a project card
Expand All @@ -220,7 +219,7 @@ To create a project card for the pull request, pass the `pull-request-number` st
```yml
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v6
uses: peter-evans/create-pull-request@v5

- name: Create or Update Project Card
if: ${{ steps.cpr.outputs.pull-request-number }}
Expand Down Expand Up @@ -255,12 +254,12 @@ jobs:

- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v6
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.PAT }}
commit-message: Update report
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
author: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com>
committer: GitHub <noreply@github.com>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
signoff: false
branch: example-patches
delete-branch: true
Expand Down
4 changes: 2 additions & 2 deletions __test__/create-or-update-branch.int.test.ts
Expand Up @@ -8,7 +8,7 @@ import {GitCommandManager} from '../lib/git-command-manager'
import * as path from 'path'
import {v4 as uuidv4} from 'uuid'

const REPO_PATH = '/git/local/repos/test-base'
const REPO_PATH = '/git/local/test-base'
const REMOTE_NAME = 'origin'

const TRACKED_FILE = 'a/tracked-file.txt'
Expand All @@ -22,7 +22,7 @@ const INIT_COMMIT_MESSAGE = 'Add file to be a tracked file for tests'
const BRANCH = 'tests/create-pull-request/patch'
const BASE = DEFAULT_BRANCH

const FORK_REMOTE_URL = 'git://127.0.0.1/repos/test-fork.git'
const FORK_REMOTE_URL = 'git://127.0.0.1/test-fork.git'
const FORK_REMOTE_NAME = 'fork'

const ADD_PATHS_DEFAULT = []
Expand Down
14 changes: 7 additions & 7 deletions __test__/entrypoint.sh
Expand Up @@ -5,18 +5,18 @@ set -euo pipefail
WORKINGDIR=$PWD

# Create and serve a remote repo
mkdir -p /git/remote/repos
mkdir -p /git/remote
git config --global init.defaultBranch main
git init --bare /git/remote/repos/test-base.git
git init --bare /git/remote/test-base.git
git daemon --verbose --enable=receive-pack --base-path=/git/remote --export-all /git/remote &>/dev/null &

# Give the daemon time to start
sleep 2

# Create a local clone and make an initial commit
mkdir -p /git/local/repos
git clone git://127.0.0.1/repos/test-base.git /git/local/repos/test-base
cd /git/local/repos/test-base
mkdir -p /git/local
git clone git://127.0.0.1/test-base.git /git/local/test-base
cd /git/local/test-base
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
echo "#test-base" > README.md
Expand All @@ -30,8 +30,8 @@ git config -l

# Clone a server-side fork of the base repo
cd $WORKINGDIR
git clone --mirror git://127.0.0.1/repos/test-base.git /git/remote/repos/test-fork.git
cd /git/remote/repos/test-fork.git
git clone --mirror git://127.0.0.1/test-base.git /git/remote/test-fork.git
cd /git/remote/test-fork.git
git log -1 --pretty=oneline

# Restore the working directory
Expand Down
@@ -1,86 +1,70 @@
import {GitCommandManager} from '../lib/git-command-manager'
import {GitConfigHelper} from '../lib/git-config-helper'
import {GitAuthHelper} from '../lib/git-auth-helper'

const REPO_PATH = '/git/local/repos/test-base'
const REPO_PATH = '/git/local/test-base'

const extraheaderConfigKey = 'http.https://127.0.0.1/.extraheader'
const extraheaderConfigKey = 'http.https://github.com/.extraheader'

describe('git-config-helper integration tests', () => {
describe('git-auth-helper tests', () => {
let git: GitCommandManager
let gitConfigHelper: GitConfigHelper
let gitAuthHelper: GitAuthHelper

beforeAll(async () => {
git = await GitCommandManager.create(REPO_PATH)
gitAuthHelper = new GitAuthHelper(git)
})

it('tests save and restore with no persisted auth', async () => {
const gitConfigHelper = await GitConfigHelper.create(git)
await gitConfigHelper.close()
await gitAuthHelper.savePersistedAuth()
await gitAuthHelper.restorePersistedAuth()
})

it('tests configure and removal of auth', async () => {
const gitConfigHelper = await GitConfigHelper.create(git)
await gitConfigHelper.configureToken('github-token')
await gitAuthHelper.configureToken('github-token')
expect(await git.configExists(extraheaderConfigKey)).toBeTruthy()
expect(await git.getConfigValue(extraheaderConfigKey)).toEqual(
'AUTHORIZATION: basic eC1hY2Nlc3MtdG9rZW46Z2l0aHViLXRva2Vu'
)

await gitConfigHelper.close()
await gitAuthHelper.removeAuth()
expect(await git.configExists(extraheaderConfigKey)).toBeFalsy()
})

it('tests save and restore of persisted auth', async () => {
const extraheaderConfigValue = 'AUTHORIZATION: basic ***persisted-auth***'
await git.config(extraheaderConfigKey, extraheaderConfigValue)

const gitConfigHelper = await GitConfigHelper.create(git)
await gitAuthHelper.savePersistedAuth()

const exists = await git.configExists(extraheaderConfigKey)
expect(exists).toBeFalsy()

await gitConfigHelper.close()
await gitAuthHelper.restorePersistedAuth()

const configValue = await git.getConfigValue(extraheaderConfigKey)
expect(configValue).toEqual(extraheaderConfigValue)

const unset = await git.tryConfigUnset(
extraheaderConfigKey,
'^AUTHORIZATION:'
)
expect(unset).toBeTruthy()
await gitAuthHelper.removeAuth()
})

it('tests not adding/removing the safe.directory config when it already exists', async () => {
it('tests adding and removing the safe.directory config', async () => {
await git.config('safe.directory', '/another-value', true, true)

const gitConfigHelper = await GitConfigHelper.create(git)

expect(
await git.configExists('safe.directory', '/another-value', true)
).toBeTruthy()

await gitConfigHelper.close()

const unset = await git.tryConfigUnset(
'safe.directory',
'/another-value',
true
)
expect(unset).toBeTruthy()
})

it('tests adding and removing the safe.directory config', async () => {
const gitConfigHelper = await GitConfigHelper.create(git)
await gitAuthHelper.removeSafeDirectory()
await gitAuthHelper.addSafeDirectory()

expect(
await git.configExists('safe.directory', REPO_PATH, true)
).toBeTruthy()

await gitConfigHelper.close()
await gitAuthHelper.addSafeDirectory()
await gitAuthHelper.removeSafeDirectory()

expect(
await git.configExists('safe.directory', REPO_PATH, true)
).toBeFalsy()
expect(
await git.configExists('safe.directory', '/another-value', true)
).toBeTruthy()
})
})
93 changes: 0 additions & 93 deletions __test__/git-config-helper.unit.test.ts

This file was deleted.

0 comments on commit 3cd226b

Please sign in to comment.