Skip to content

Commit 15bf7c7

Browse files
authored
Merged to main
2 parents 3814ab7 + e66dad4 commit 15bf7c7

File tree

4 files changed

+112
-33
lines changed

4 files changed

+112
-33
lines changed

β€Ž.github/workflows/pipeline.yaml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Pipeline
2+
on: [push]
3+
jobs:
4+
pipeline:
5+
runs-on: ubuntu-latest
6+
permissions:
7+
contents: write
8+
packages: read
9+
statuses: write
10+
steps:
11+
- name: Checkout code
12+
uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 0
15+
ref: main
16+
17+
- name: Super-linter
18+
uses: super-linter/[email protected]
19+
env:
20+
GITHUB_TOKEN: ${{ secrets.WF_TOKEN }}
21+
VALIDATE_BASH: false
22+
VALIDATE_CHECKOV: false
23+
FIX_MARKDOWN: true
24+
FIX_MARKDOWN_PRETTIER: true
25+
FIX_NATURAL_LANGUAGE: true
26+
FIX_SHELL_SHFMT: true
27+
FIX_YAML_PRETTIER: true
28+
29+
- name: Commit linting fixes
30+
if: github.ref_name != 'main'
31+
run: |
32+
git config --global user.email "[email protected]"
33+
git config --global user.name "Wesley Scholl"
34+
git add -A
35+
git commit -m "chore: fix linting issues"
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.WF_TOKEN }}
38+
39+
- name: Commit and push linting fixes
40+
if: github.ref_name != 'main'
41+
uses: stefanzweifel/git-auto-commit-action@v5
42+
with:
43+
branch: ${{ github.ref_name }}
44+
commit_message: "chore: fix linting issues"
45+
commit_user_name: Wesley Scholl
46+
commit_user_email: [email protected]
47+
48+
- name: Merge branch
49+
uses: julbme/gh-action-merge-branch@v1
50+
with:
51+
from: ${{ github.ref_name }}
52+
to: main
53+
message: Merged to main
54+
push_options: '--force'
55+
skip_fetch: true
56+
env:
57+
GITHUB_TOKEN: ${{ secrets.WF_TOKEN }}

β€ŽREADME.md

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,40 +3,40 @@
33
Manually typing staging, commit messages, and push commands is repetative. Especially copying the ticket number into the commit message. Save time using this shell script.
44

55
## Table of Contents
6-
* [What this script automates](#what-this-script-automates)
7-
* [User input required](#user-input-required)
8-
* [Requirements](#requirements)
9-
* [Installation](#installation)
10-
* [Usage](#usage)
11-
* [License](#license)
12-
13-
## What this script automates:
14-
15-
| Name | Description |
16-
| --- | --- |
17-
| Git Staging | Staging any modified files for commit using `git add -A`. |
6+
7+
- [What this script automates](#what-this-script-automates)
8+
- [User input required](#user-input-required)
9+
- [Requirements](#requirements)
10+
- [Installation](#installation)
11+
- [Usage](#usage)
12+
- [License](#license)
13+
14+
## What this script automates
15+
16+
| Name | Description |
17+
| ------------------ | -------------------------------------------------------------------------------------------------- |
18+
| Git Staging | Staging any modified files for commit using `git add -A`. |
1819
| Git Commit Message | Copying the ticket number of the Jira ticket as the commit message prefix. Example: `[CRS-12345]`. |
19-
| Git Commit | Committing staged files with the commit message using `git commit -S -m "<commit message>"`. |
20-
| Git Push | Pushing local commits to remote branch with `git push`. |
20+
| Git Commit | Committing staged files with the commit message using `git commit -S -m "<commit message>"`. |
21+
| Git Push | Pushing local commits to remote branch with `git push`. |
2122

22-
## User input required:
23+
## User input required
2324

24-
| Name | Description |
25-
| --- | --- |
26-
| Alias Command | The alias command to be used for the script: `cm`. |
25+
| Name | Description |
26+
| -------------- | -------------------------------------------------------- |
27+
| Alias Command | The alias command to be used for the script: `cm`. |
2728
| Commit Message | The commit message with description of the changes made. |
2829

2930
## Requirements
3031

31-
| Name | Description | Link, Location, or Command |
32-
| --- | --- | --- |
33-
| Terminal or Shell | A terminal or shell for configuring and running the script. | [Download Terminal](https://www.apple.com/macos/terminal/) |
34-
| `Git Bash` ***Required for Windows** | Git Bash provides a UNIX command line emulator for windows which can be used to run Git, shell commands, and much more. | [Download Git Bash](https://gitforwindows.org/) |
35-
32+
| Name | Description | Link, Location, or Command |
33+
| ------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- |
34+
| Terminal or Shell | A terminal or shell for configuring and running the script. | [Download Terminal](https://www.apple.com/macos/terminal/) |
35+
| `Git Bash` **\*Required for Windows** | Git Bash provides a Unix command line emulator for windows which can be used to run Git, shell commands, and much more. | [Download Git Bash](https://gitforwindows.org/) |
3636

3737
## Installation
3838

39-
1. Clone the git-commit-push-script repository to your local computer.
39+
1. Clone the git-commit-push-script repository to your local computer.
4040

4141
```shell
4242
git clone https://github.com/wesleyscholl/git-commit-push-script.git
@@ -49,16 +49,19 @@ cd git-commit-push-script
4949
```
5050

5151
3. Make the script executable by running the following command:
52+
5253
```shell
5354
chmod +x git-commit-push-script.sh
5455
```
5556

5657
4. Configure the alias command for the script in zshrc or bash_profile.
58+
5759
```shell
5860
alias cm='bash /path/to/git-commit-push-script/git-commit-push-script.sh'
5961
```
6062

6163
5. Reload the terminal or shell configuration by running the following command:
64+
6265
```shell
6366
source ~/.zshrc
6467
# OR #
@@ -74,11 +77,13 @@ cm
7477
```
7578

7679
7. Enter your commit message when prompted.
80+
7781
```shell
7882
Enter commit message: <Enter your commit message here>
7983
```
8084

8185
8. The script will stage, commit with the ticket prefix, and push the changes to the remote branch.
86+
8287
```shell
8388
Enter commit message: Test message
8489
Commit message: CRS-12345 - Test message
@@ -97,16 +102,20 @@ To https://github.com/wesleyscholl/git-commit-push-script.git
97102
## Troubleshooting
98103

99104
You may encounter an error from the following command because of the `-S` flag:
105+
100106
```shell
101-
git commit -S -m "<commit message>"
107+
git commit -S -m "<commit message>"
102108
```
109+
103110
To resolve this error, remove the `-S` from the command in the `git-commit-push-script.sh` file:
111+
104112
```shell
105113
git commit -m "<commit message>"
106114
```
115+
107116
If you want to use the -S flag, configure your Git configuration to use the GPG key for signing commits.
108-
Use the guide here: https://docs.github.com/en/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key
117+
Use the guide here: <https://docs.github.com/en/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key>
109118

110119
## License
111-
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
112120

121+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

β€Žgit-commit-push-script.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ git commit -S -m "$ticket $message"
2121
remote_branch=$(git ls-remote --heads origin $base_branch)
2222

2323
if [ -z "$remote_branch" ]; then
24-
echo "Branch '$base_branch' does not exist on remote. Creating it."
25-
# Push the local branch to the remote, setting the upstream branch
26-
git push --set-upstream origin $base_branch
24+
echo "Branch '$base_branch' does not exist on remote. Creating it."
25+
# Push the local branch to the remote, setting the upstream branch
26+
git push --set-upstream origin $base_branch
2727
else
28-
echo "Branch '$base_branch' exists on remote. Pushing changes."
29-
# Push changes to the remote
30-
git push
28+
echo "Branch '$base_branch' exists on remote. Pushing changes."
29+
# Push changes to the remote
30+
git push
3131
fi
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Super-linter summary
2+
3+
| Language | Validation result |
4+
| ----------------- | ----------------- |
5+
| BASH_EXEC | Pass βœ… |
6+
| GITLEAKS | Pass βœ… |
7+
| JSCPD | Pass βœ… |
8+
| MARKDOWN | Pass βœ… |
9+
| MARKDOWN_PRETTIER | Pass βœ… |
10+
| NATURAL_LANGUAGE | Pass βœ… |
11+
| SHELL_SHFMT | Pass βœ… |
12+
13+
All files and directories linted successfully

0 commit comments

Comments
Β (0)