diff --git a/.github/workflows/update-variable.yml b/.github/workflows/update-variable.yml deleted file mode 100644 index 1c39e7b3..00000000 --- a/.github/workflows/update-variable.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Update GitHub Variable - -on: - workflow_dispatch: - -jobs: - update-variable: - runs-on: ubuntu-latest - steps: - - name: Update GitHub Actions Variable - run: | - repo_name="NiharikaJamble/specimin" - api_url="https://api.github.com" - - # Fetch the public key for encrypting the variable - public_key_response=$(curl -s -H "Authorization: token ${{ secrets.UPDATE_VARIABLE_TOKEN }}" "$api_url/repos/$repo_name/actions/variables/public-key") - public_key=$(echo $public_key_response | jq -r .key) - key_id=$(echo $public_key_response | jq -r .key_id) - - # Check if public key is fetched successfully - if [[ -z "$public_key" || "$public_key" == "null" ]]; then - echo "Error fetching public key: $public_key_response" - exit 1 - fi - - # Encrypt the new value - new_accuracy="88.61" - encrypted_value=$(echo -n "$new_accuracy" | openssl pkeyutl -encrypt -pubin -inkey <(echo "$public_key") | base64) - - # Update the variable with the encrypted value - update_response=$(curl -s -X PUT \ - -H "Authorization: token ${{ secrets.UPDATE_VARIABLE_TOKEN }}" \ - -H "Content-Type: application/json" \ - "$api_url/repos/$repo_name/actions/variables/LATEST_SPECIMIN_EVAL_PERCENTAGE" \ - -d "{\"encrypted_value\":\"$encrypted_value\",\"key_id\":\"$key_id\"}") - - # Check if the update was successful - if echo "$update_response" | jq -e '.message' > /dev/null; then - echo "Error updating variable: $(echo $update_response | jq -r '.message')" - exit 1 - else - echo "Variable updated successfully!" - fi - env: - UPDATE_VARIABLE_TOKEN: ${{ secrets.UPDATE_VARIABLE_TOKEN }}