Skip to content

Commit

Permalink
chore: add workflow for repository structure
Browse files Browse the repository at this point in the history
  • Loading branch information
fiam committed Sep 29, 2024
1 parent 02e2641 commit 3dbb8e3
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/existing-repo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Update README from Template and Ensure necessary files are present

on:
workflow_dispatch:
inputs:
target_branch:
description: 'Branch to update in the target repository'
required: true
default: 'main'

jobs:
update-files:
runs-on: ubuntu-latest

steps:
- name: Checkout target repository
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.target_branch }}

- name: Set up Git
run: |
git config user.name "github-actions"
git config user.email "[email protected]"
- name: Clone template repository
run: |
git clone https://github.com/dockersamples/sample-app-template.git template-repo
- name: Ensure README.md, CONTRIBUTING.md, and LICENSE
run: |
# Update README.md
cp template-repo/README.md README.md
# Check if CONTRIBUTING.md exists, if not copy from template
if [ ! -f CONTRIBUTING.md ]; then
echo "CONTRIBUTING.md not found, adding it."
cp template-repo/CONTRIBUTING.md CONTRIBUTING.md
fi
# Check if LICENSE file exists, if not copy from template
if [ ! -f LICENSE ]; then
echo "LICENSE.md not found, adding it."
cp template-repo/LICENSE LICENSE
fi
- name: Commit and push changes
run: |
git add README.md CONTRIBUTING.md LICENSE
git commit -m "Update README.md and ensure CONTRIBUTING.md and LICENSE are present" || echo "No changes to commit"
git push origin ${{ github.event.inputs.target_branch }}
- name: Clean up
run: rm -rf template-repo

0 comments on commit 3dbb8e3

Please sign in to comment.