diff --git a/.forgejo/workflows/copy-file.yml b/.forgejo/workflows/copy-file.yml new file mode 100644 index 0000000..a999853 --- /dev/null +++ b/.forgejo/workflows/copy-file.yml @@ -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 \ No newline at end of file