Add .forgejo/workflows/copy-file.yml

This commit is contained in:
dsklyadnev 2024-08-01 13:14:30 +00:00
parent 7704f4094c
commit ed494067e0

View file

@ -0,0 +1,58 @@
name: Copy file
description: Copy file
on:
workflow_call:
inputs:
org:
required: true
type: string
repo:
required: true
type: string
branch:
required: true
type: string
file:
required: true
type: string
jobs:
upd:
runs-on: host
steps:
- name: Checkout workflows
uses: actions/checkout@v4
with:
path: develop/workflows
- name: Checkout repo
uses: actions/checkout@v4
with:
repository: ${{ inputs.org }}/${{ inputs.repo }}
ref: ${{ inputs.branch }}
path: ${{ inputs.org }}/${{ inputs.repo }}
token: ${{ secrets.RW_TOKEN }}
- name: Update repo
run: |
WFDIR=$ORG/$REPO/.forgejo/workflows
mkdir -p $WFDIR
cp develop/workflows/$WF $WFDIR/
env:
ORG: ${{ inputs.org }}
REPO: ${{ inputs.repo }}
WF: ${{ inputs.file }}
- name: Check for changes
run: |
if (cd ${{ inputs.org }}/${{ inputs.repo }} && git status) | grep -c 'nothing to commit'; then
echo "::set-env name=changes_exist::false"
else
echo "::set-env name=changes_exist::true"
fi
- name: Commit changes
working-directory: ${{ inputs.org }}/${{ inputs.repo }}
if: env.changes_exist == 'true'
run: |
git add -A
git commit -m "update workflow"
git push