diff --git a/.github/workflows/update-argocd-metadata.yml b/.github/workflows/update-argocd-metadata.yml index 797ef72a6..f6690f967 100644 --- a/.github/workflows/update-argocd-metadata.yml +++ b/.github/workflows/update-argocd-metadata.yml @@ -33,30 +33,24 @@ jobs: check-name: Build Website Docker Image repo-token: ${{ secrets.GITHUB_TOKEN }} - - name: Update config.json in argocd_metadata - if: github.ref == 'refs/heads/main' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Checkout External Repository + uses: actions/checkout@v3 + with: + repository: 'pathoplexus/argocd_metadata' # Replace with the correct repository path + # token: ${{ secrets.PAT }} # Personal Access Token with appropriate permissions + + - name: Modify config.json + run: | + # Assuming config.json is in the root directory of the repository + # Perform necessary modifications here. Example: + echo '{ + "new_key": "new_value" + }' > config.json + + - name: Commit and Push Changes run: | - # Fetching the current content of config.json from the repository - curl -H "Authorization: token $GITHUB_TOKEN" \ - -H "Accept: application/vnd.github.v3+json" \ - "https://api.github.com/repos/pathoplexus/argocd_metadata/contents/config.json" \ - -o config.json - - # Extracting the SHA of the current config.json for update purposes - CONFIG_SHA=$(jq -r '.sha' config.json) - - # Updating the file with the new SHA - NEW_CONTENT=$(jq '.head_short_sha_7 = "'$(echo $GITHUB_SHA | cut -c1-7)'"' config.json | base64) - - # Preparing the payload for updating the file in the repository - PAYLOAD=$(jq -n --arg content "$NEW_CONTENT" \ - --arg sha "$CONFIG_SHA" \ - '{message: "Update head_short_sha_7", content: $content, sha: $sha}') - - # Pushing the updated content back to the repository - curl -X PUT -H "Authorization: token $GITHUB_TOKEN" \ - -H "Accept: application/vnd.github.v3+json" \ - -d "$PAYLOAD" \ - "https://api.github.com/repos/pathoplexus/argocd_metadata/contents/config.json" \ No newline at end of file + git config --global user.name 'Your Name' + git config --global user.email 'your-email@example.com' + git add config.json + git commit -m "Update config.json" + git push \ No newline at end of file