Skip to content

Hamster Left A Pull Request - (Create mirror.yml) #11

Hamster Left A Pull Request - (Create mirror.yml)

Hamster Left A Pull Request - (Create mirror.yml) #11

Workflow file for this run

name: CI / Automated Issue
on:
pull_request:
types: ['opened', 'closed']
issue_comment:
types: ['created']
workflow_dispatch:
jobs:
create_issue:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.state == 'open' }}
steps:
- uses: actions/checkout@v4
- name: Generate Issue Template
run: |
timestamp=$(date '+%b %d, %A %I:%M:%S %p')
markdown=$(cat <<EOF
## Notification Regarding the Pull Request:
> [!IMPORTANT]
> What Happened: ${{ github.event_name }} event by Hamster [bot].
> Details of Run: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
- Author: @TheHamsterBot
- Branch: ${{ github.base_ref }} (base) / ${{ github.head_ref }} (head)
- Commit: ${{ github.sha }}
- Workflow Path: ${{ github.workflow_ref }}
- Pull Request Number: #${{ github.event.number }}
- Pull Request Title: ${{ github.event.pull_request.title }}
---
Thanks.
$timestamp
Your Hamster 🐹 <code>PF78VAPPKLZ2</code>
EOF)
echo "$markdown" > .github/Auto_Issue_Request.md
echo "MARKDOWN_CONTENT<<EOF" >> $GITHUB_ENV
echo "$markdown" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Create Dynamic Issue
uses: offensive-vk/auto-issue@v7
with:
github-token: ${{ secrets.BOT_TOKEN }}
title: |
${{ github.workflow }} - ${{ github.head_ref }}
assignees: TheHamsterBot
labels: automated,bot,hamster,issue
body: |
${{ env.MARKDOWN_CONTENT }}
close_issue:
runs-on: ubuntu-latest
if: |
github.event_name == 'issue_comment' &&
github.event.issue.state == 'open' &&
contains(github.event.issue.labels[*].name, 'automated') &&
github.event.issue.user.login == 'TheHamsterBot' &&
contains(github.event.comment.body, 'hamster --close') &&
(github.event.comment.user.login == github.event.repository.owner.login ||
github.event.comment.user.login == github.event.issue.user.login)
steps:
- name: Close Issue
uses: peter-evans/close-issue@v3
with:
token: ${{ secrets.BOT_TOKEN }}
issue-number: ${{ github.event.issue.number }}
comment: 'Hamster [bot] - Closed This Issue. (As Requested)'