From 63b24d14f36ec4735ba4c6ac7861c9267c6942c8 Mon Sep 17 00:00:00 2001 From: walkowif <59475134+walkowif@users.noreply.github.com> Date: Thu, 26 Sep 2024 16:14:48 +0200 Subject: [PATCH] Copy and restore DESCRIPTION (#9) --- action.yaml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/action.yaml b/action.yaml index bfbba84..24907ed 100644 --- a/action.yaml +++ b/action.yaml @@ -54,6 +54,11 @@ inputs: Comma-separated list of pkgcache-compatible repository names from which the dependencies will be downloaded. required: false default: "PPM@latest" + restore-description: + description: | + Whether the DESCRIPTION file (modified by this action) should be restored to its original contents? + required: false + default: true branding: icon: 'download' @@ -79,6 +84,17 @@ runs: fi shell: bash + - name: Copy DESCRIPTION + if: ${{ inputs.restore-description == 'true' }} + run: | + echo "::group::Copy DESCRIPTION" + temp_desc=$(mktemp) + cp ${{ inputs.repository-path }}/DESCRIPTION $temp_desc + echo "TEMP_DESCRIPTION=$temp_desc" >> $GITHUB_ENV + ls -l $temp_desc + echo "::endgroup::" + shell: bash + - name: Install required packages uses: r-lib/actions/setup-r-dependencies@v2 with: @@ -372,3 +388,12 @@ runs: DepsBranch DepsDev dependencies: ${{ inputs.dependencies }} + + - name: Restore DESCRIPTION + if: ${{ inputs.restore-description == 'true' }} + run: | + echo "::group::Restore DESCRIPTION" + cp ${{ env.TEMP_DESCRIPTION }} ${{ inputs.repository-path }}/DESCRIPTION + ls -l ${{ inputs.repository-path }}/DESCRIPTION + echo "::endgroup::" + shell: bash