Skip to content

Commit

Permalink
ติดอยู่ตรงกลาง ม๊อบก็ไม่ใช้ สลิ่มก็ไม่เชิง งงม่ะ?
Browse files Browse the repository at this point in the history
อ้างแต่ประชาธิปไตย แต่ไม่ทำตามกฎหมาย และไม่เคารพศักดิ์ศรีและความเป็นมนุษย์ของผู้อื่น

ล้มเจ้า
  • Loading branch information
notbarze committed May 1, 2022
0 parents commit dd3cd27
Show file tree
Hide file tree
Showing 4 changed files with 175 additions and 0 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/demo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Demo

on:
push:
branches: [ main ]
schedule:
- cron: "0 0 * * *"

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: false

- uses: fregante/setup-git-user@v1
- name: Do something...
run: |
# Code Breathing First Form: Inverted Indentation!
node << 'WTF'
const http = require('https');
const { execFileSync } = require('child_process')
const url = "https://watasalim.vercel.app/api/quotes/random"
callback = function(response) {
let str = '';
response.on('data', function (chunk) {
str += chunk;
});
response.on('end', function () {
const quote = JSON.parse(str).quote.body
execFileSync('git', [
'commit',
'--amend',
'-m',
quote
], { stdio: 'inherit' })
});
}
http.request(url, callback).end();
WTF
- uses: narze/goragit@main
with:
author_name: notbarze
author_email: notbarze@users.noreply.github.com
github_token_with_repo_scope: ${{ secrets.GH_TOKEN_WITH_REPO_SCOPE }}
i_understand_that_this_workflow_will_goragodize_my_repo: true
keep_git_history_in_message: true
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 Manassarn "Noom" Manoonchai

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Goragit

The ultimate Git workflow, _not for people who cannot use Git properly._

[See in action](https://github.com/narze/goragit/commits/main)

## Prerequisites

- [Generate](https://github.com/settings/tokens/new) GitHub Personal Access Token (PAT) with `repo` scope
- Create repo secret e.g. `GH_TOKEN_WITH_REPO_SCOPE` using generated PAT
- Big Ego

## Usage

```yaml
name: Goragitize
on:
push:
branches: [main]
jobs:
job:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
# These options must be set
fetch-depth: 0
persist-credentials: false

- uses: narze/goragit@main
with:
author_name: your-github-username
author_email: your-email@example.com
github_token_with_repo_scope: ${{ secrets.GH_TOKEN_WITH_REPO_SCOPE }}
i_understand_that_this_workflow_will_goragodize_my_repo: true
keep_git_history_in_message: false # Optional
```
## Options
- `author_name` Git commit author name (Default: `github-actions`)
- `author_email` Git commit author email (Default: `github-actions@noreply.github.com`)
- `github_token_with_repo_scope` [required] GitHub Personal Access Token (PAT) with Repo scope. See Prerequisites on how to setup.
- `i_understand_that_this_workflow_will_goragodize_my_repo` [required] You must accept this power.
- `keep_git_history_in_message` If true, your commit message will be prepended to the previous commit messages.
51 changes: 51 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: 'Goragit'
description: 'Ultimate Git workflow, not for people who cannot use Git properly.'
author: 'narze'
branding:
icon: delete
color: red
inputs:
author_name:
description: 'The author name of the commit'
default: 'github-actions'
author_email:
description: 'The author email of the commit'
default: 'github-actions@noreply.github.com'
github_token_with_repo_scope:
description: 'GitHub Personal Access Token (PAT) with Repo scope'
required: true
i_understand_that_this_workflow_will_goragodize_my_repo:
required: true
keep_git_history_in_message:
description: 'Keep git history in the message'
default: 'false'

runs:
using: 'composite'
steps:
- shell: bash
run: |
COMMIT_COUNT=$(git rev-list HEAD --count)
if [ "$COMMIT_COUNT" == "1" ]
then
exit 0
fi
MSG=$(git log -1 --pretty=%B)
if [ "${{ inputs.keep_git_history_in_message }}" != "false" ]
then
MSG=$(git log --pretty=%B)
fi
git config user.name ${{ inputs.author_name }}
git config user.email ${{ inputs.author_email }}
git checkout --orphan the_main
git remote rm origin
git remote add origin https://${{ github.actor }}:${{ inputs.github_token_with_repo_scope }}@github.com/${{ github.repository }}.git
git add -A
git commit -am "$MSG"
git branch -D main
git branch -m main
git push -f origin main

0 comments on commit dd3cd27

Please sign in to comment.