CI / Automated Pull Request #653
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
name: CI / Automated Pull Request | |
on: | |
push: | |
branches-ignore: | |
- "master" | |
- "old" | |
- "main" | |
- "2023" | |
- "nov-2023" | |
- "specialized-commits" | |
workflow_dispatch: | |
schedule: | |
- cron: '0 */1 * * *' | |
jobs: | |
create_pr: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Create or Update Pull Request | |
id: create-pr | |
uses: repo-sync/pull-request@v2 | |
with: | |
github_token: ${{ secrets.BOT_TOKEN }} | |
destination_branch: "master" | |
pr_title: "Hamster Left A Pull Request - (${{ github.event.head_commit.message }})" | |
pr_body: "### Hamster is working here. Sit Tight !" | |
pr_reviewer: "offensive-vk" | |
pr_label: "bot,automated,hamster" | |
pr_assignee: "TheHamsterBot" | |
pr_draft: false | |
- name: Save PR Number in ENV | |
run: echo "PR_NUMBER=${{ steps.create-pr.outputs.number }}" >> $GITHUB_ENV; echo "Pull Request Number - ${{ env.PR_NUMBER }}" | |
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 ${{ github.action_ref }} . | |
> Details of Run: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
- Author: @TheHamsterBot | |
- Branch: master (base) / ${{ github.event.ref }} (head) | |
- Commit: ${{ github.sha }} | |
- Workflow Path: ${{ github.workflow }} | |
- Pull Request Number: #${{ env.PR_NUMBER }} || #${{ steps.create-pr.outputs.number }} | |
- Pusher Details: ${{ github.actor }} <${{ github.event.pusher.email }}> | |
--- | |
Thanks. | |
$timestamp | |
Your Hamster 🐹 <code>PF78VAPPKLZ2</code> | |
EOF) | |
echo "$markdown" > .github/Auto_Pull_Request.md | |
echo "MARKDOWN<<EOF" >> $GITHUB_ENV | |
echo "$markdown" >> $GITHUB_ENV | |
echo "EOF" >> $GITHUB_ENV | |
- name: Update Pull Request Body | |
run: | | |
gh pr edit "$PR_NUMBER" --body "$MARKDOWN" | |
continue-on-error: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} |