Manual workflow #8
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
# This is a basic workflow that is manually triggered | |
name: Manual workflow | |
# Controls when the action will run. Workflow runs when manually triggered using the UI | |
# or API. | |
on: | |
workflow_dispatch: | |
# Inputs the workflow accepts. | |
inputs: | |
repository: | |
description: 'GitHub repository from which to download the file (e.g., user/repo)' | |
default: 'Repick-official/repick-server-v2' | |
required: true | |
type: string | |
branch: | |
description: 'Branch from which to download the file (e.g., main)' | |
default: 'develop' | |
required: true | |
type: string | |
filepath: | |
description: 'Path to the file within the repository (e.g., README.md)' | |
default: 'README.md' | |
required: true | |
type: string | |
jobs: | |
download-file: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout | |
- name: Checkout the repository | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
# Step 2: Download the file using curl | |
- name: Download file using curl | |
run: | | |
echo "Downloading ${{ inputs.filepath }} from ${{ inputs.repository }} on branch ${{ inputs.branch }}" | |
sudo curl -o readme.md https://raw.githubusercontent.com/${{ inputs.repository }}/${{ inputs.branch }}/${{ inputs.filepath }} | |
# Step 3: List the downloaded file to confirm | |
- name: Confirm file download | |
run: cat readme.md | |
# Step 4: Commit and push changes to the repository | |
- name: Commit and push changes | |
run: | | |
git config --global user.name "github-actions" | |
git config --global user.email "[email protected]" | |
git add readme.md | |
git commit -m "Update README.md from ${{ inputs.repository }} (branch: ${{ inputs.branch }})" | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKEN }} |