-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add workflow for repository structure
- Loading branch information
Showing
1 changed file
with
54 additions
and
0 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,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 |