Skip to content

Commit

Permalink
Update configure-new-repo.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
TheDayIsMyEnemy authored Feb 25, 2024
1 parent 18cd391 commit 39de9fd
Showing 1 changed file with 9 additions and 33 deletions.
42 changes: 9 additions & 33 deletions .github/workflows/configure-new-repo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,21 @@ on:
branches:
- main

permissions:
actions: write
checks: write
contents: write
pull-requests: write
statuses: write

jobs:
configure-new-repo:
runs-on: ubuntu-latest

if: ${{ github.event.created && github.repository != 'TheDayIsMyEnemy/BlazorTemplate' }}
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Git
run: |
git config --global user.email "thedayismyenemy@users.github.no-reply.com"
git config --global user.name "thedayismyenemy"
uses: actions/checkout@v4

- name: Update Project Structure
run: |
Expand All @@ -30,32 +32,6 @@ jobs:
- name: Commit and Push Changes
run: |
git checkout -b "update-project-structure"
git add -A
git commit -m "Update project structure"
git push origin update-project-structure --force
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}

- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v3
with:
title: "Update project structure to match repository name"
labels: "auto-update"
branch: "update-project-structure"
base: "main"

- name: Close Pull Request
run: |
PR_NUMBER=$(echo "${{ steps.cpr.outputs.pull-request }}")
TOKEN=${{ secrets.PAT_TOKEN }}
COMMENT="Closing PR as completed. Thank you!"
curl -X POST -H "Authorization: Bearer $TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${{ github.repository }}/pulls/$PR_NUMBER/comments" \
-d "{\"body\":\"$COMMENT\",\"event\":\"COMMENT\"}"
curl -X PATCH -H "Authorization: Bearer $TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${{ github.repository }}/pulls/$PR_NUMBER" \
-d "{\"state\":\"closed\"}"
git push origin main --force

0 comments on commit 39de9fd

Please sign in to comment.