Copy Result JSON on Commit #11
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
name: Copy Result JSON on Commit | |
on: | |
push: | |
branches: | |
- did-lint-reports | |
paths: | |
- 'result.json' | |
workflow_dispatch: | |
jobs: | |
copy-result-json: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v4 | |
- name: Get current timestamp | |
id: timestamp | |
uses: nanzm/get-time-action@master | |
with: | |
timeZone: UTC | |
format: 'YYYY-MM-DDTHH:mm:ss.sssZ' | |
- 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.time }}.json | |
jq . result_${{ steps.timestamp.outputs.time }}.json > tmp.json && mv tmp.json result_${{ steps.timestamp.outputs.time }}.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 | |
git branch --set-upstream-to=origin/new-result new-result | |
git pull | |
mv ../result_${{ steps.timestamp.outputs.time }}.json . | |
git add result_${{ steps.timestamp.outputs.time }}.json | |
git commit -m "Add new result file" | |
git push -u origin new-result | |