From bb8e4aee7d06a6796518d3a09f4fccee1df36bb6 Mon Sep 17 00:00:00 2001 From: brrock Date: Sun, 1 Dec 2024 15:15:04 +0000 Subject: [PATCH 01/17] Add .github/workflows/bosh.yaml --- .github/workflows/bosh.yaml | 73 +++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 .github/workflows/bosh.yaml diff --git a/.github/workflows/bosh.yaml b/.github/workflows/bosh.yaml new file mode 100644 index 0000000..8ce043a --- /dev/null +++ b/.github/workflows/bosh.yaml @@ -0,0 +1,73 @@ +name: Test and Notify Pipeline + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + test-and-notify: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} + + - name: Setup SSH for Git server + uses: webfactory/ssh-agent@v0.8.0 + with: + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} + + - name: Add Git server to known hosts + run: | + mkdir -p ~/.ssh + ssh-keyscan -H 192.168.0.35 >> ~/.ssh/known_hosts + + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: latest + + - name: Install Bun + uses: oven-sh/setup-bun@v1 + with: + bun-version: latest + + - name: Install Dependencies + run: pnpm install + + - name: Run Tests + id: tests + run: pnpm test + continue-on-error: true + + - name: Run Prettier + id: prettier + run: pnpm prettier + continue-on-error: true + + - name: Commit Prettier Changes + if: steps.prettier.outcome == 'success' + run: | + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + git add . + git diff --staged --quiet || git commit -m "style: apply prettier formatting" + git push + + - name: Handle Notification + if: steps.tests.outcome == 'failure' || steps.prettier.outcome == 'failure' + run: | + cd /tmp + # Using SSH URL + git clone git@192.168.0.35:brrock/gitemailthinggamex.git + cd gitemailthinggamex + bun install + if [[ "${{ steps.tests.outcome }}" == "failure" || "${{ steps.prettier.outcome }}" == "failure" ]]; then + bun run sendfailed + else + bun run sendsuccess + fi \ No newline at end of file From dafab6cf58c013d1574bf374a01b1781a2d9d22a Mon Sep 17 00:00:00 2001 From: brrock Date: Sun, 1 Dec 2024 15:19:26 +0000 Subject: [PATCH 02/17] cool --- .github/workflows/bosh.yaml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/bosh.yaml b/.github/workflows/bosh.yaml index 8ce043a..f27c82b 100644 --- a/.github/workflows/bosh.yaml +++ b/.github/workflows/bosh.yaml @@ -11,19 +11,18 @@ jobs: runs-on: ubuntu-latest steps: + # Checkout with deploy key for the main repo - uses: actions/checkout@v3 with: fetch-depth: 0 - ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} + ssh-key: ${{ secrets.DEPLOY_KEY }} - - name: Setup SSH for Git server - uses: webfactory/ssh-agent@v0.8.0 - with: - ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} - - - name: Add Git server to known hosts + # Setup SSH for the notification repo + - name: Configure Git server SSH run: | mkdir -p ~/.ssh + echo "${{ secrets.DEPLOY_KEY }}" > ~/.ssh/deploy_key + chmod 600 ~/.ssh/deploy_key ssh-keyscan -H 192.168.0.35 >> ~/.ssh/known_hosts - name: Install pnpm @@ -41,7 +40,7 @@ jobs: - name: Run Tests id: tests - run: pnpm test + run: echo "not implemted" continue-on-error: true - name: Run Prettier @@ -60,9 +59,10 @@ jobs: - name: Handle Notification if: steps.tests.outcome == 'failure' || steps.prettier.outcome == 'failure' + env: + GIT_SSH_COMMAND: "ssh -i ~/.ssh/deploy_key" run: | cd /tmp - # Using SSH URL git clone git@192.168.0.35:brrock/gitemailthinggamex.git cd gitemailthinggamex bun install From ab6896477ae0e9078acc08b26e3b595b9f6d5953 Mon Sep 17 00:00:00 2001 From: brrock Date: Sun, 1 Dec 2024 15:21:54 +0000 Subject: [PATCH 03/17] bosh --- .github/workflows/bosh.yaml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/bosh.yaml b/.github/workflows/bosh.yaml index f27c82b..e881997 100644 --- a/.github/workflows/bosh.yaml +++ b/.github/workflows/bosh.yaml @@ -17,12 +17,16 @@ jobs: fetch-depth: 0 ssh-key: ${{ secrets.DEPLOY_KEY }} - # Setup SSH for the notification repo - - name: Configure Git server SSH + # Setup SSH for the Git server access + - name: Setup SSH + uses: webfactory/ssh-agent@v0.8.0 + with: + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} + + # Add Git server to known hosts + - name: Configure Git server run: | mkdir -p ~/.ssh - echo "${{ secrets.DEPLOY_KEY }}" > ~/.ssh/deploy_key - chmod 600 ~/.ssh/deploy_key ssh-keyscan -H 192.168.0.35 >> ~/.ssh/known_hosts - name: Install pnpm @@ -40,7 +44,7 @@ jobs: - name: Run Tests id: tests - run: echo "not implemted" + run: pnpm test continue-on-error: true - name: Run Prettier @@ -59,8 +63,6 @@ jobs: - name: Handle Notification if: steps.tests.outcome == 'failure' || steps.prettier.outcome == 'failure' - env: - GIT_SSH_COMMAND: "ssh -i ~/.ssh/deploy_key" run: | cd /tmp git clone git@192.168.0.35:brrock/gitemailthinggamex.git From 16da110056e604a8450de3a54c1ac605955e42db Mon Sep 17 00:00:00 2001 From: brrock Date: Sun, 1 Dec 2024 15:23:42 +0000 Subject: [PATCH 04/17] attempt 2 --- .github/workflows/bosh.yaml | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/.github/workflows/bosh.yaml b/.github/workflows/bosh.yaml index e881997..ae98e07 100644 --- a/.github/workflows/bosh.yaml +++ b/.github/workflows/bosh.yaml @@ -15,20 +15,8 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 0 - ssh-key: ${{ secrets.DEPLOY_KEY }} # Setup SSH for the Git server access - - name: Setup SSH - uses: webfactory/ssh-agent@v0.8.0 - with: - ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} - - # Add Git server to known hosts - - name: Configure Git server - run: | - mkdir -p ~/.ssh - ssh-keyscan -H 192.168.0.35 >> ~/.ssh/known_hosts - - name: Install pnpm uses: pnpm/action-setup@v2 with: @@ -65,7 +53,7 @@ jobs: if: steps.tests.outcome == 'failure' || steps.prettier.outcome == 'failure' run: | cd /tmp - git clone git@192.168.0.35:brrock/gitemailthinggamex.git + git clone http://192.168.0.35:3000/brrock/gitemailthinggamex.git cd gitemailthinggamex bun install if [[ "${{ steps.tests.outcome }}" == "failure" || "${{ steps.prettier.outcome }}" == "failure" ]]; then From 8bc8de6e7dcdd997bd98e2eb5a19135046eeae15 Mon Sep 17 00:00:00 2001 From: brrock Date: Sun, 1 Dec 2024 15:29:16 +0000 Subject: [PATCH 05/17] ok this now should ship --- .github/workflows/bosh.yaml | 38 ++++++++++++------------------------- 1 file changed, 12 insertions(+), 26 deletions(-) diff --git a/.github/workflows/bosh.yaml b/.github/workflows/bosh.yaml index ae98e07..52b2d37 100644 --- a/.github/workflows/bosh.yaml +++ b/.github/workflows/bosh.yaml @@ -2,53 +2,39 @@ name: Test and Notify Pipeline on: push: - branches: [ main ] + branches: [main] pull_request: - branches: [ main ] + branches: [main] jobs: test-and-notify: runs-on: ubuntu-latest - + steps: # Checkout with deploy key for the main repo - uses: actions/checkout@v3 with: fetch-depth: 0 - - # Setup SSH for the Git server access + + - name: Install pnpm uses: pnpm/action-setup@v2 with: version: latest - + - name: Install Bun uses: oven-sh/setup-bun@v1 with: bun-version: latest - + - name: Install Dependencies run: pnpm install - + - name: Run Tests id: tests - run: pnpm test - continue-on-error: true - - - name: Run Prettier - id: prettier - run: pnpm prettier + run: echo "hi" continue-on-error: true - - - name: Commit Prettier Changes - if: steps.prettier.outcome == 'success' - run: | - git config --global user.name 'github-actions[bot]' - git config --global user.email 'github-actions[bot]@users.noreply.github.com' - git add . - git diff --staged --quiet || git commit -m "style: apply prettier formatting" - git push - + - name: Handle Notification if: steps.tests.outcome == 'failure' || steps.prettier.outcome == 'failure' run: | @@ -56,8 +42,8 @@ jobs: git clone http://192.168.0.35:3000/brrock/gitemailthinggamex.git cd gitemailthinggamex bun install - if [[ "${{ steps.tests.outcome }}" == "failure" || "${{ steps.prettier.outcome }}" == "failure" ]]; then + if [[ "${{ steps.tests.outcome }}" == "failure" then bun run sendfailed else bun run sendsuccess - fi \ No newline at end of file + fi From 4b84f4d50e8810dd1a8c5f65b8d2359e23459931 Mon Sep 17 00:00:00 2001 From: brrock Date: Sun, 1 Dec 2024 15:33:38 +0000 Subject: [PATCH 06/17] Update .github/workflows/bosh.yaml --- .github/workflows/bosh.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bosh.yaml b/.github/workflows/bosh.yaml index 52b2d37..0a92ae7 100644 --- a/.github/workflows/bosh.yaml +++ b/.github/workflows/bosh.yaml @@ -36,7 +36,7 @@ jobs: continue-on-error: true - name: Handle Notification - if: steps.tests.outcome == 'failure' || steps.prettier.outcome == 'failure' + if: steps.tests.outcome == 'failure' run: | cd /tmp git clone http://192.168.0.35:3000/brrock/gitemailthinggamex.git From 1229fb12748565665a3ca250de98a1c1b9710b3a Mon Sep 17 00:00:00 2001 From: brrock Date: Sun, 1 Dec 2024 15:37:18 +0000 Subject: [PATCH 07/17] Update .github/workflows/bosh.yaml --- .github/workflows/bosh.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/bosh.yaml b/.github/workflows/bosh.yaml index 0a92ae7..41cf783 100644 --- a/.github/workflows/bosh.yaml +++ b/.github/workflows/bosh.yaml @@ -36,7 +36,6 @@ jobs: continue-on-error: true - name: Handle Notification - if: steps.tests.outcome == 'failure' run: | cd /tmp git clone http://192.168.0.35:3000/brrock/gitemailthinggamex.git From 64b035ee0e3a33b6910de56d5081a4f2db32a471 Mon Sep 17 00:00:00 2001 From: brrock Date: Sun, 1 Dec 2024 16:39:18 +0000 Subject: [PATCH 08/17] test --- .github/workflows/bosh.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/bosh.yaml b/.github/workflows/bosh.yaml index 41cf783..482c46b 100644 --- a/.github/workflows/bosh.yaml +++ b/.github/workflows/bosh.yaml @@ -16,7 +16,6 @@ jobs: with: fetch-depth: 0 - - name: Install pnpm uses: pnpm/action-setup@v2 with: @@ -32,7 +31,9 @@ jobs: - name: Run Tests id: tests - run: echo "hi" + run: | + echo "Running tests..." + exit 1 # Simulate failure continue-on-error: true - name: Handle Notification @@ -41,7 +42,8 @@ jobs: git clone http://192.168.0.35:3000/brrock/gitemailthinggamex.git cd gitemailthinggamex bun install - if [[ "${{ steps.tests.outcome }}" == "failure" then + + if [ "${{ steps.tests.outcome }}" = "failure" ]; then bun run sendfailed else bun run sendsuccess From 00b95f4642b5d8647f91ee63c1cca5c9d46a3cb9 Mon Sep 17 00:00:00 2001 From: brrock Date: Sun, 1 Dec 2024 18:01:51 +0000 Subject: [PATCH 09/17] Update .github/workflows/bosh.yaml --- .github/workflows/bosh.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bosh.yaml b/.github/workflows/bosh.yaml index 482c46b..f7dfdb0 100644 --- a/.github/workflows/bosh.yaml +++ b/.github/workflows/bosh.yaml @@ -33,7 +33,7 @@ jobs: id: tests run: | echo "Running tests..." - exit 1 # Simulate failure + continue-on-error: true - name: Handle Notification From 58c8ff3cf7667060369af6f556c859858eb1b6a8 Mon Sep 17 00:00:00 2001 From: brrock Date: Tue, 3 Dec 2024 07:36:54 +0000 Subject: [PATCH 10/17] add github pr action --- .github/workflows/ghpr.yaml | 66 +++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 .github/workflows/ghpr.yaml diff --git a/.github/workflows/ghpr.yaml b/.github/workflows/ghpr.yaml new file mode 100644 index 0000000..4b2f3e6 --- /dev/null +++ b/.github/workflows/ghpr.yaml @@ -0,0 +1,66 @@ +name: Create GitHub PR from Gitea + +on: + workflow_dispatch: + +jobs: + gh_pr: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Fetch all history for all branches and tags + + - name: Setup GitHub CLI + uses: actions4gh/setup-gh@v1 + with: + gh-version: 'latest' + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Configure git + run: | + git config --global user.name "GitHub Actions Bot" + git config --global user.email "actions@github.com" + + # Create .gitignore for GitHub-specific files if it doesn't exist + echo ".github/workflows/ghpr.yaml" >> .gitignore + echo ".github/workflows/bosh.yaml" >> .gitignore + + - name: Add GitHub remote and push + run: | + # Remove the workflow files from git tracking + git rm --cached .github/workflows/ghpr.yaml || true + git rm --cached .github/workflows/bosh.yaml || true + + # Add GitHub remote + git remote add github https://github.com/brrock/gamex.git + + # Create and switch to canary branch + git checkout -b canary + + # Commit the gitignore changes if any + git add .gitignore + git commit -m "chore: update gitignore for workflow files" || true + + # Push to GitHub repository + git push github canary --force + + - name: Create PR + run: | + gh pr create \ + --repo ${{ secrets.GH_REPOSITORY }} \ + --base main \ + --head canary \ + --title "feat: sync changes from Gitea" \ + --body "## Automated PR from Gitea + + This PR contains the latest changes from Gitea repository. + + Please review the changes carefully before merging." + + - name: Cleanup + if: always() + run: | + git checkout main + git branch -D canary \ No newline at end of file From e0eb3c46995968151344ecdc10dc70fd707f4fc7 Mon Sep 17 00:00:00 2001 From: brrock Date: Tue, 3 Dec 2024 19:57:37 +0000 Subject: [PATCH 11/17] update method of pushing to gh --- .github/workflows/ghpr.yaml | 93 +++++++++++++++++++++++++------------ 1 file changed, 63 insertions(+), 30 deletions(-) diff --git a/.github/workflows/ghpr.yaml b/.github/workflows/ghpr.yaml index 4b2f3e6..687b6f6 100644 --- a/.github/workflows/ghpr.yaml +++ b/.github/workflows/ghpr.yaml @@ -1,66 +1,99 @@ name: Create GitHub PR from Gitea on: - workflow_dispatch: + workflow_dispatch: # Manual trigger + paths-ignore: + - '.github/workflows/**' # Avoid recursive triggers + issue_comment: + types: [created] jobs: gh_pr: runs-on: ubuntu-latest + if: ${{ github.event.comment.body == '!actions run pr' || github.event.pusher != '' || github.event.workflow_dispatch }} steps: - - uses: actions/checkout@v4 + - name: Checkout code + uses: actions/checkout@v4 with: - fetch-depth: 0 # Fetch all history for all branches and tags + fetch-depth: 0 # Full history for better sync - name: Setup GitHub CLI uses: actions4gh/setup-gh@v1 with: gh-version: 'latest' - token: ${{ secrets.GITHUB_TOKEN }} + token: ${{ secrets.GH_TOKEN }} # Changed from GITHUB_TOKEN for cross-repo access - name: Configure git run: | - git config --global user.name "GitHub Actions Bot" - git config --global user.email "actions@github.com" + git config --global user.name "brrock" + git config --global user.email "brduck@duck.com" - # Create .gitignore for GitHub-specific files if it doesn't exist - echo ".github/workflows/ghpr.yaml" >> .gitignore - echo ".github/workflows/bosh.yaml" >> .gitignore + # Setup .gitignore for workflow files + if [ ! -f .gitignore ]; then + touch .gitignore + fi + + # Ensure workflow files are ignored + grep -qxF '.github/workflows/ghpr.yaml' .gitignore || echo '.github/workflows/ghpr.yaml' >> .gitignore + grep -qxF '.github/workflows/bosh.yaml' .gitignore || echo '.github/workflows/bosh.yaml' >> .gitignore - name: Add GitHub remote and push + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} run: | - # Remove the workflow files from git tracking - git rm --cached .github/workflows/ghpr.yaml || true - git rm --cached .github/workflows/bosh.yaml || true + # Clean up workflow files from git + git rm --cached .github/workflows/ghpr.yaml 2>/dev/null || true + git rm --cached .github/workflows/bosh.yaml 2>/dev/null || true - # Add GitHub remote - git remote add github https://github.com/brrock/gamex.git + # Add GitHub remote using token for authentication + git remote add github https://${GH_TOKEN}@github.com/brrock/gamex.git - # Create and switch to canary branch - git checkout -b canary + # Create and checkout sync branch + git checkout -b gitea-sync-$(date +%Y%m%d-%H%M%S) - # Commit the gitignore changes if any + # Stage and commit gitignore changes git add .gitignore git commit -m "chore: update gitignore for workflow files" || true - # Push to GitHub repository - git push github canary --force + # Push to GitHub + git push github gitea-sync-$(date +%Y%m%d-%H%M%S) --force - - name: Create PR + - name: Create Pull Request + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} run: | - gh pr create \ - --repo ${{ secrets.GH_REPOSITORY }} \ - --base main \ - --head canary \ - --title "feat: sync changes from Gitea" \ - --body "## Automated PR from Gitea + BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD) + + # Check if PR already exists + existing_pr=$(gh pr list \ + --repo brrock/gamex \ + --head $BRANCH_NAME \ + --json number \ + --jq '.[0].number') + + if [ -z "$existing_pr" ]; then + # Create new PR + gh pr create \ + --repo brrock/gamex \ + --base main \ + --head $BRANCH_NAME \ + --title "feat: sync changes from Gitea ($(date +%Y-%m-%d))" \ + --body "## Automated Sync from Gitea - This PR contains the latest changes from Gitea repository. - - Please review the changes carefully before merging." + This PR contains the latest changes synchronized from the Gitea repository. + + ### Changes included: + $(git log --pretty=format:'- %s' main..$BRANCH_NAME) + + Please review the changes carefully before merging." + else + echo "PR already exists with number #$existing_pr" + fi - name: Cleanup if: always() run: | + BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD) git checkout main - git branch -D canary \ No newline at end of file + git branch -D $BRANCH_NAME || true \ No newline at end of file From e17a9ff793fc6271bb7d2eee16ab85ce3492225f Mon Sep 17 00:00:00 2001 From: brrock Date: Tue, 3 Dec 2024 20:11:46 +0000 Subject: [PATCH 12/17] ok pls --- .github/workflows/ghpr.yaml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ghpr.yaml b/.github/workflows/ghpr.yaml index 687b6f6..2055a47 100644 --- a/.github/workflows/ghpr.yaml +++ b/.github/workflows/ghpr.yaml @@ -17,12 +17,11 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 # Full history for better sync - - - name: Setup GitHub CLI - uses: actions4gh/setup-gh@v1 - with: - gh-version: 'latest' - token: ${{ secrets.GH_TOKEN }} # Changed from GITHUB_TOKEN for cross-repo access + + - name: Install GitHub CLI + run: | + curl -sS https://webi.sh/gh | sh + gh auth login --with-token <<< "${{ secrets.GH_TOKEN }}" - name: Configure git run: | @@ -49,15 +48,16 @@ jobs: # Add GitHub remote using token for authentication git remote add github https://${GH_TOKEN}@github.com/brrock/gamex.git - # Create and checkout sync branch - git checkout -b gitea-sync-$(date +%Y%m%d-%H%M%S) + # Create and checkout canary branch + BRANCH_NAME=canary + git checkout -b $BRANCH_NAME # Stage and commit gitignore changes git add .gitignore git commit -m "chore: update gitignore for workflow files" || true # Push to GitHub - git push github gitea-sync-$(date +%Y%m%d-%H%M%S) --force + git push github $BRANCH_NAME --force - name: Create Pull Request env: @@ -96,4 +96,4 @@ jobs: run: | BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD) git checkout main - git branch -D $BRANCH_NAME || true \ No newline at end of file + git branch -D $BRANCH_NAME || true From cff13ba439736dbf2e9adef072478d42b0fee52e Mon Sep 17 00:00:00 2001 From: brrock Date: Tue, 3 Dec 2024 20:12:58 +0000 Subject: [PATCH 13/17] umm --- .github/workflows/ghpr.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ghpr.yaml b/.github/workflows/ghpr.yaml index 2055a47..90079aa 100644 --- a/.github/workflows/ghpr.yaml +++ b/.github/workflows/ghpr.yaml @@ -21,6 +21,7 @@ jobs: - name: Install GitHub CLI run: | curl -sS https://webi.sh/gh | sh + source .bashrc gh auth login --with-token <<< "${{ secrets.GH_TOKEN }}" - name: Configure git From abc872601ed1038192e893faedaf914c44330ad7 Mon Sep 17 00:00:00 2001 From: brrock Date: Tue, 3 Dec 2024 20:14:21 +0000 Subject: [PATCH 14/17] now --- .github/workflows/ghpr.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ghpr.yaml b/.github/workflows/ghpr.yaml index 90079aa..e9fad50 100644 --- a/.github/workflows/ghpr.yaml +++ b/.github/workflows/ghpr.yaml @@ -21,7 +21,7 @@ jobs: - name: Install GitHub CLI run: | curl -sS https://webi.sh/gh | sh - source .bashrc + source ~/.config/envman/PATH.env gh auth login --with-token <<< "${{ secrets.GH_TOKEN }}" - name: Configure git From 42852c4a0dcbd3514ed9259a10cb78bc3d43ad59 Mon Sep 17 00:00:00 2001 From: brrock Date: Tue, 3 Dec 2024 20:17:06 +0000 Subject: [PATCH 15/17] final --- .github/workflows/ghpr.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ghpr.yaml b/.github/workflows/ghpr.yaml index e9fad50..0403b69 100644 --- a/.github/workflows/ghpr.yaml +++ b/.github/workflows/ghpr.yaml @@ -22,7 +22,7 @@ jobs: run: | curl -sS https://webi.sh/gh | sh source ~/.config/envman/PATH.env - gh auth login --with-token <<< "${{ secrets.GH_TOKEN }}" + gh auth login --with-token <<< "${{ secrets.GH_TOKEN }}" && gh auth status && echo done - name: Configure git run: | @@ -65,7 +65,7 @@ jobs: GH_TOKEN: ${{ secrets.GH_TOKEN }} run: | BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD) - + source ~/.config/envman/PATH.env # Check if PR already exists existing_pr=$(gh pr list \ --repo brrock/gamex \ From 1511fbff73b685b518d48f30b426835a843bcd82 Mon Sep 17 00:00:00 2001 From: brrock Date: Tue, 3 Dec 2024 20:19:56 +0000 Subject: [PATCH 16/17] chore: update gitignore for workflow files --- .github/workflows/bosh.yaml | 50 ------------------ .github/workflows/ghpr.yaml | 100 ------------------------------------ .gitignore | 3 +- 3 files changed, 2 insertions(+), 151 deletions(-) delete mode 100644 .github/workflows/bosh.yaml delete mode 100644 .github/workflows/ghpr.yaml diff --git a/.github/workflows/bosh.yaml b/.github/workflows/bosh.yaml deleted file mode 100644 index f7dfdb0..0000000 --- a/.github/workflows/bosh.yaml +++ /dev/null @@ -1,50 +0,0 @@ -name: Test and Notify Pipeline - -on: - push: - branches: [main] - pull_request: - branches: [main] - -jobs: - test-and-notify: - runs-on: ubuntu-latest - - steps: - # Checkout with deploy key for the main repo - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Install pnpm - uses: pnpm/action-setup@v2 - with: - version: latest - - - name: Install Bun - uses: oven-sh/setup-bun@v1 - with: - bun-version: latest - - - name: Install Dependencies - run: pnpm install - - - name: Run Tests - id: tests - run: | - echo "Running tests..." - - continue-on-error: true - - - name: Handle Notification - run: | - cd /tmp - git clone http://192.168.0.35:3000/brrock/gitemailthinggamex.git - cd gitemailthinggamex - bun install - - if [ "${{ steps.tests.outcome }}" = "failure" ]; then - bun run sendfailed - else - bun run sendsuccess - fi diff --git a/.github/workflows/ghpr.yaml b/.github/workflows/ghpr.yaml deleted file mode 100644 index 0403b69..0000000 --- a/.github/workflows/ghpr.yaml +++ /dev/null @@ -1,100 +0,0 @@ -name: Create GitHub PR from Gitea - -on: - workflow_dispatch: # Manual trigger - paths-ignore: - - '.github/workflows/**' # Avoid recursive triggers - issue_comment: - types: [created] - -jobs: - gh_pr: - runs-on: ubuntu-latest - if: ${{ github.event.comment.body == '!actions run pr' || github.event.pusher != '' || github.event.workflow_dispatch }} - - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 0 # Full history for better sync - - - name: Install GitHub CLI - run: | - curl -sS https://webi.sh/gh | sh - source ~/.config/envman/PATH.env - gh auth login --with-token <<< "${{ secrets.GH_TOKEN }}" && gh auth status && echo done - - - name: Configure git - run: | - git config --global user.name "brrock" - git config --global user.email "brduck@duck.com" - - # Setup .gitignore for workflow files - if [ ! -f .gitignore ]; then - touch .gitignore - fi - - # Ensure workflow files are ignored - grep -qxF '.github/workflows/ghpr.yaml' .gitignore || echo '.github/workflows/ghpr.yaml' >> .gitignore - grep -qxF '.github/workflows/bosh.yaml' .gitignore || echo '.github/workflows/bosh.yaml' >> .gitignore - - - name: Add GitHub remote and push - env: - GH_TOKEN: ${{ secrets.GH_TOKEN }} - run: | - # Clean up workflow files from git - git rm --cached .github/workflows/ghpr.yaml 2>/dev/null || true - git rm --cached .github/workflows/bosh.yaml 2>/dev/null || true - - # Add GitHub remote using token for authentication - git remote add github https://${GH_TOKEN}@github.com/brrock/gamex.git - - # Create and checkout canary branch - BRANCH_NAME=canary - git checkout -b $BRANCH_NAME - - # Stage and commit gitignore changes - git add .gitignore - git commit -m "chore: update gitignore for workflow files" || true - - # Push to GitHub - git push github $BRANCH_NAME --force - - - name: Create Pull Request - env: - GH_TOKEN: ${{ secrets.GH_TOKEN }} - run: | - BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD) - source ~/.config/envman/PATH.env - # Check if PR already exists - existing_pr=$(gh pr list \ - --repo brrock/gamex \ - --head $BRANCH_NAME \ - --json number \ - --jq '.[0].number') - - if [ -z "$existing_pr" ]; then - # Create new PR - gh pr create \ - --repo brrock/gamex \ - --base main \ - --head $BRANCH_NAME \ - --title "feat: sync changes from Gitea ($(date +%Y-%m-%d))" \ - --body "## Automated Sync from Gitea - - This PR contains the latest changes synchronized from the Gitea repository. - - ### Changes included: - $(git log --pretty=format:'- %s' main..$BRANCH_NAME) - - Please review the changes carefully before merging." - else - echo "PR already exists with number #$existing_pr" - fi - - - name: Cleanup - if: always() - run: | - BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD) - git checkout main - git branch -D $BRANCH_NAME || true diff --git a/.gitignore b/.gitignore index 7f5ed77..db5e525 100644 --- a/.gitignore +++ b/.gitignore @@ -38,4 +38,5 @@ prisma/migrations **/**/app/test .turbo packages/ui/dist -packages/**/dist \ No newline at end of file +packages/**/dist.github/workflows/ghpr.yaml +.github/workflows/bosh.yaml From 55c46b18c0f6ba7dae2feb4e6fd55561899fbc8d Mon Sep 17 00:00:00 2001 From: Benjy <123623302+brrock@users.noreply.github.com> Date: Tue, 3 Dec 2024 20:21:58 +0000 Subject: [PATCH 17/17] Update .gitignore --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index db5e525..cd87ae8 100644 --- a/.gitignore +++ b/.gitignore @@ -38,5 +38,6 @@ prisma/migrations **/**/app/test .turbo packages/ui/dist -packages/**/dist.github/workflows/ghpr.yaml +packages/**/dist +.github/workflows/ghpr.yaml .github/workflows/bosh.yaml