-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
42f900d
commit b0baf6b
Showing
2 changed files
with
255 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,255 @@ | ||
name: CI / Automated Pull Request | ||
|
||
on: | ||
push: | ||
branches-ignore: | ||
- "classic" | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '0 */1 * * *' | ||
|
||
jobs: | ||
create_pr: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Get Branch Info | ||
id: branch-info | ||
run: | | ||
echo "BASE_REF=$(git symbolic-ref --short HEAD)" >> $GITHUB_ENV | ||
echo "HEAD_REF=$(git symbolic-ref --short HEAD)" >> $GITHUB_ENV | ||
- name: Create or Open A PR | ||
id: create-pr | ||
uses: repo-sync/pull-request@v2 | ||
with: | ||
github_token: ${{ secrets.BOT_TOKEN }} | ||
destination_branch: "classic" | ||
pr_title: "${{ github.workflow }} - (${{ github.event.head_commit.message }})" | ||
pr_body: "Details are on their way... - says Hamster." | ||
pr_reviewer: "offensive-vk" | ||
pr_label: "bot,automated,hamster,pull-request" | ||
pr_assignee: "TheHamsterBot" | ||
pr_draft: false | ||
continue-on-error: true | ||
|
||
- name: Save PR Number in ENV | ||
run: echo "PR_NUMBER=${{ steps.create-pr.outputs.pull-request-url }}" >> $GITHUB_ENV | ||
|
||
update_pr: | ||
needs: create_pr | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Generate Pull Request Template | ||
run: | | ||
timestamp=$(date '+%b %d, %A %I:%M:%S %p') | ||
markdown=$(cat <<EOF | ||
## This Pull Request Was Automated by [Hamster [bot]](https://github.com/TheHamsterBot) | ||
> [!NOTE] | ||
> Workflow Trigger: ${{ github.event_name }} event at ${{ env.HEAD_REF }} branch. | ||
> Details of Run: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
- Author: @TheHamsterBot | ||
- Branch: ${{ env.BASE_REF }} (base) / ${{ env.HEAD_REF }} (head) | ||
- Commit: ${{ github.sha }} | ||
- Workflow Path: ${{ github.workflow }} | ||
- Pull Request Number: #${{ env.PR_NUMBER }} | ||
- Pusher Details: ${{ github.actor }} <${{ github.actor }}> | ||
--- | ||
Thanks. | ||
$timestamp | ||
Your Hamster 🐹 <code>PR90XPOMFW68FM</code> | ||
EOF) | ||
echo "$markdown" > .github/Auto_Pull_Request.md | ||
echo "MARKDOWN_CONTENT<<EOF" >> $GITHUB_ENV | ||
echo "$markdown" >> $GITHUB_ENV | ||
echo "EOF" >> $GITHUB_ENV | ||
- name: Update Pull Request Body | ||
run: | | ||
gh pr edit "$PR_NUMBER" --body "$MARKDOWN_CONTENT" | ||
continue-on-error: true | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} | ||
|
||
create_issue_on_success: | ||
runs-on: ubuntu-latest | ||
needs: create_pr | ||
if: success() | ||
steps: | ||
- name: Create Issue using Bot | ||
uses: dacbd/create-issue-action@main | ||
with: | ||
token: ${{ secrets.BOT_TOKEN }} | ||
title: | | ||
${{ github.workflow }} - PR Created Successfully | ||
assignees: TheHamsterBot | ||
labels: automated,bot | ||
body: | | ||
## Pull Request Created Successfully: | ||
- Author: @TheHamsterBot | ||
- PR URL: ${{ env.PR_NUMBER }} | ||
- Branch: ${{ github.ref }} | ||
- Commit: ${{ github.sha }} | ||
- Workflow Path: ${{ github.workflow }} | ||
- Branch: ${{ env.BASE_REF }} (base) / ${{ env.HEAD_REF }} (head) | ||
- Pull Request Number: #${{ env.PR_NUMBER }} | ||
create_issue_on_failure: | ||
runs-on: ubuntu-latest | ||
needs: create_pr | ||
if: failure() | ||
steps: | ||
- name: Create Failure Issue | ||
uses: dacbd/create-issue-action@main | ||
with: | ||
token: ${{ secrets.BOT_TOKEN }} | ||
title: | | ||
${{ github.workflow }} - PR Creation Failed | ||
assignees: TheHamsterBot | ||
labels: automated,bot | ||
body: | | ||
## Pull Request Creation Failed: | ||
> [!WARNING] | ||
> Workflow Trigger: ${{ github.event_name }} event at ${{ env.BASE_REF }} branch. | ||
> Details of Run: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
- Author: @TheHamsterBot | ||
- Branch: ${{ github.ref }} | ||
- Commit: ${{ github.sha }} | ||
- Workflow Path: ${{ github.workflow }} | ||
- Error: ${{ job.status }} | ||
# name: CI / Automated Pull Request | ||
|
||
# on: | ||
# push: | ||
# branches-ignore: | ||
# - "classic" | ||
# workflow_dispatch: | ||
# schedule: | ||
# - cron: '0 */1 * * *' | ||
|
||
# jobs: | ||
# create_pr: | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - uses: actions/checkout@v4 | ||
# - name: Get Branch Info | ||
# id: branch-info | ||
# run: | | ||
# echo "BASE_REF=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV | ||
# echo "HEAD_REF=$(git rev-parse --abbrev-ref origin/HEAD)" >> $GITHUB_ENV | ||
|
||
# - name: Create or Open A PR | ||
# id: create-pr | ||
# uses: repo-sync/pull-request@v2 | ||
# with: | ||
# github_token: ${{ secrets.BOT_TOKEN }} | ||
# destination_branch: "classic" | ||
# pr_title: "${{ github.workflow }} - (${{ github.event.head_commit.message }})" | ||
# pr_body: "Details are on their way... - says Hamster." | ||
# pr_reviewer: "offensive-vk" | ||
# pr_label: "bot,automated,hamster,pull-request" | ||
# pr_assignee: "TheHamsterBot" | ||
# pr_draft: false | ||
|
||
# - name: Save PR Number in ENV | ||
# run: echo "PR_NUMBER=${{ steps.create-pr.outputs.number }}" >> $GITHUB_ENV | ||
|
||
# update_pr: | ||
# needs: create_pr | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - uses: actions/checkout@v4 | ||
# - name: Generate Pull Request Template | ||
# run: | | ||
# timestamp=$(date '+%b %d, %A %I:%M:%S %p') | ||
# markdown=$(cat <<EOF | ||
# ## This Pull Request Was Automated by [Hamster [bot]](https://github.com/TheHamsterBot) | ||
|
||
# > [!NOTE] | ||
# > Workflow Trigger: ${{ github.event_name }} event at ${{ env.HEAD_REF }} branch. | ||
# > Details of Run: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
|
||
# - Author: @TheHamsterBot | ||
# - Branch: ${{ env.BASE_REF }} (base) / ${{ env.HEAD_REF }} (head) | ||
# - Commit: ${{ github.sha }} | ||
# - Workflow Path: ${{ github.workflow }} | ||
# - Pull Request Number: #${{ env.PR_NUMBER }} | ||
# - Pusher Details: ${{ github.event.issue.user.id }} <${{ github.event.pusher.email }}> | ||
|
||
# --- | ||
|
||
# Thanks. | ||
# $timestamp | ||
# Your Hamster 🐹 <code>PR90XPOMFW68FM</code> | ||
# EOF) | ||
# echo "$markdown" > .github/Auto_Pull_Request.md | ||
# echo "MARKDOWN_CONTENT<<EOF" >> $GITHUB_ENV | ||
# echo "$markdown" >> $GITHUB_ENV | ||
# echo "EOF" >> $GITHUB_ENV | ||
|
||
# - name: Update Pull Request Body | ||
# run: | | ||
# gh pr edit "$PR_NUMBER" --body "$MARKDOWN_CONTENT" | ||
# continue-on-error: true | ||
# env: | ||
# GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} | ||
|
||
# create_issue_on_success: | ||
# runs-on: ubuntu-latest | ||
# needs: create_pr | ||
# if: success() | ||
# steps: | ||
# - name: Create Issue using Bot | ||
# uses: dacbd/create-issue-action@main | ||
# with: | ||
# token: ${{ secrets.BOT_TOKEN }} | ||
# title: | | ||
# ${{ github.workflow }} - PR Created Successfully | ||
# assignees: TheHamsterBot | ||
# labels: automated,bot | ||
# body: | | ||
# ## Pull Requeste Created Successfully: | ||
|
||
# - Author: @TheHamsterBot | ||
# - PR URL: ${{ steps.open-pr.outputs.pull-request-url }} | ||
# - Branch: ${{ github.ref }} | ||
# - Commit: ${{ github.sha }} | ||
# - Workflow Path: ${{ github.workflow_ref }} | ||
# - Branch: ${{ github.base_ref }} (base) / ${{ github.head_ref }} (head) | ||
# - Pull Request Number: #${{ github.event.number }} | ||
# - Pull Request Title: ${{ github.event.pull_request.title }} | ||
|
||
# create_issue_on_failure: | ||
# runs-on: ubuntu-latest | ||
# needs: create_pr | ||
# if: failure() | ||
# steps: | ||
# - name: Create Failure Issue | ||
# uses: dacbd/create-issue-action@main | ||
# with: | ||
# token: ${{ secrets.BOT_TOKEN }} | ||
# title: | | ||
# ${{ github.workflow }} - PR Creation Failed | ||
# assignees: TheHamsterBot | ||
# labels: automated,bot | ||
# body: | | ||
# ## Pull Request Creation Failed: | ||
|
||
# > [!WARNING] | ||
# > Workflow Trigger: ${{ github.event_name }} event at ${{ github.event.base_ref }} branch. | ||
# > Details of Run: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
|
||
# - Author: @TheHamsterBot | ||
# - Branch: ${{ github.ref }} | ||
# - Commit: ${{ github.sha }} | ||
# - Workflow Path: ${{ github.workflow_ref }} | ||
# - Error: ${{ job.status }} |
This file was deleted.
Oops, something went wrong.