From 1ef26747283a0a42c86cc481689a414c754cba10 Mon Sep 17 00:00:00 2001 From: Kim Hamilton Duffy Date: Mon, 4 Mar 2024 03:28:27 -0800 Subject: [PATCH] Create archive_lint_reports.yml (#407) * Create archive_lint_reports.yml Github action to archive lint result.json files * Update archive_lint_reports.yml code review feedback --- .github/workflows/archive_lint_reports.yml | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/archive_lint_reports.yml diff --git a/.github/workflows/archive_lint_reports.yml b/.github/workflows/archive_lint_reports.yml new file mode 100644 index 000000000..c99815a5c --- /dev/null +++ b/.github/workflows/archive_lint_reports.yml @@ -0,0 +1,46 @@ +name: Copy Result JSON on Commit + +on: + push: + branches: + - did-lint-reports + paths: + - 'result.json' + +jobs: + copy-result-json: + runs-on: ubuntu-latest + steps: + - name: Checkout source code + uses: actions/checkout@v4 + + - name: Get current timestamp + id: timestamp + run: echo "name=timestamp::$(date +'%Y%m%d%H%M%S')" >> "$GITHUB_OUTPUT" + + - name: Install dependencies + run: sudo apt-get install jq -y + + - name: Configure git user + run: | + git config --global user.name 'Kim Duffy' + git config --global user.email 'kimdhamilton@gmail.com' + + - name: Copy result.json with timestamp + run: | + cp result.json result_${{ steps.timestamp.outputs.timestamp }}.json + jq . result_${{ steps.timestamp.outputs.timestamp }}.json > tmp.json && mv tmp.json result_${{ steps.timestamp.outputs.timestamp }}.json + + - name: Push to target repository + env: + REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }} + run: | + git clone https://x-access-token:${REPO_ACCESS_TOKEN}@github.com/decentralized-identity/universal-resolver-lint-dashboard.git + cd universal-resolver-lint-dashboard + git checkout -b new-result || git checkout new-result + mv ../result_${{ steps.timestamp.outputs.timestamp }}.json . + git add result_${{ steps.timestamp.outputs.timestamp }}.json + git commit -m "Add new result file" + git push -u origin new-result + +