Skip to content

chore: Cherry-picked changes from upstream #155

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -452,10 +452,12 @@ If you create a fine-grained personal access token, apply the `Contents`-permiss
```yaml
- uses: actions/checkout@v4
with:
token: ${{ secrets.PAT }}
# We pass the "PAT" secret to the checkout action; if no PAT secret is available to the workflow runner (eg. Dependabot) we fall back to the default "GITHUB_TOKEN".
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
```
You can learn more about Personal Access Token in the [GitHub documentation](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token).


> [!TIP]
> If you're working in an organisation, and you don't want to create the PAT from your personal account, we recommend using a bot-account for such tokens.

Expand Down
12 changes: 12 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,18 @@ inputs:
internal_git_binary:
description: Internal use only! Path to git binary used to check if git is available. (Don't change this!)
default: git
skip_fetch:
description: "Deprecated: skip_fetch has been removed in v6. It does not have any effect anymore."
required: false
default: false
skip_checkout:
description: "Deprecated: skip_checkout has been removed in v6. It does not have any effect anymore."
required: false
default: false
create_branch:
description: "Deprecated: create_branch has been removed in v6. It does not have any effect anymore."
default: false


outputs:
changes_detected:
Expand Down
42 changes: 14 additions & 28 deletions dist/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ _log() {
}

_main() {
if "$INPUT_SKIP_FETCH"; then
_log "warning" "git-auto-commit: skip_fetch has been removed in v6. It does not have any effect anymore.";
fi

if "$INPUT_SKIP_CHECKOUT"; then
_log "warning" "git-auto-commit: skip_checkout has been removed in v6. It does not have any effect anymore.";
fi

if "$INPUT_CREATE_BRANCH"; then
_log "warning" "git-auto-commit: create_branch has been removed in v6. It does not have any effect anymore.";
fi

_check_if_git_is_available

_switch_to_repository
Expand All @@ -39,8 +51,6 @@ _main() {

_set_github_output "changes_detected" "true"

_switch_to_branch

_add_files

# Check dirty state of repo again using git-diff.
Expand Down Expand Up @@ -97,32 +107,6 @@ _git_is_dirty() {
[ -n "$gitStatus" ]
}

_switch_to_branch() {
echo "INPUT_BRANCH value: $INPUT_BRANCH";

# Fetch remote to make sure that repo can be switched to the right branch.
if "$INPUT_SKIP_FETCH"; then
_log "debug" "git-fetch will not be executed.";
else
git fetch --depth=1;
fi

# If `skip_checkout`-input is true, skip the entire checkout step.
if "$INPUT_SKIP_CHECKOUT"; then
_log "debug" "git-checkout will not be executed.";
else
# Create new local branch if `create_branch`-input is true
if "$INPUT_CREATE_BRANCH"; then
# shellcheck disable=SC2086
git checkout -B $INPUT_BRANCH --;
else
# Switch to branch from current Workflow run
# shellcheck disable=SC2086
git checkout $INPUT_BRANCH --;
fi
fi
}

_add_files() {
echo "INPUT_ADD_OPTIONS: ${INPUT_ADD_OPTIONS}";
_log "debug" "Apply add options ${INPUT_ADD_OPTIONS}";
Expand Down Expand Up @@ -168,6 +152,8 @@ _tag_commit() {

_push_to_github() {

echo "INPUT_BRANCH value: $INPUT_BRANCH";

echo "INPUT_PUSH_OPTIONS: ${INPUT_PUSH_OPTIONS}";
_log "debug" "Apply push options ${INPUT_PUSH_OPTIONS}";

Expand Down
42 changes: 14 additions & 28 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ _log() {
}

_main() {
if "$INPUT_SKIP_FETCH"; then
_log "warning" "git-auto-commit: skip_fetch has been removed in v6. It does not have any effect anymore.";
fi

if "$INPUT_SKIP_CHECKOUT"; then
_log "warning" "git-auto-commit: skip_checkout has been removed in v6. It does not have any effect anymore.";
fi

if "$INPUT_CREATE_BRANCH"; then
_log "warning" "git-auto-commit: create_branch has been removed in v6. It does not have any effect anymore.";
fi

_check_if_git_is_available

_switch_to_repository
Expand All @@ -39,8 +51,6 @@ _main() {

_set_github_output "changes_detected" "true"

_switch_to_branch

_add_files

# Check dirty state of repo again using git-diff.
Expand Down Expand Up @@ -97,32 +107,6 @@ _git_is_dirty() {
[ -n "$gitStatus" ]
}

_switch_to_branch() {
echo "INPUT_BRANCH value: $INPUT_BRANCH";

# Fetch remote to make sure that repo can be switched to the right branch.
if "$INPUT_SKIP_FETCH"; then
_log "debug" "git-fetch will not be executed.";
else
git fetch --depth=1;
fi

# If `skip_checkout`-input is true, skip the entire checkout step.
if "$INPUT_SKIP_CHECKOUT"; then
_log "debug" "git-checkout will not be executed.";
else
# Create new local branch if `create_branch`-input is true
if "$INPUT_CREATE_BRANCH"; then
# shellcheck disable=SC2086
git checkout -B $INPUT_BRANCH --;
else
# Switch to branch from current Workflow run
# shellcheck disable=SC2086
git checkout $INPUT_BRANCH --;
fi
fi
}

_add_files() {
echo "INPUT_ADD_OPTIONS: ${INPUT_ADD_OPTIONS}";
_log "debug" "Apply add options ${INPUT_ADD_OPTIONS}";
Expand Down Expand Up @@ -168,6 +152,8 @@ _tag_commit() {

_push_to_github() {

echo "INPUT_BRANCH value: $INPUT_BRANCH";

echo "INPUT_PUSH_OPTIONS: ${INPUT_PUSH_OPTIONS}";
_log "debug" "Apply push options ${INPUT_PUSH_OPTIONS}";

Expand Down
Loading
Loading