fix branch and fetch stack details

This commit is contained in:
2025-09-23 22:39:28 -04:00
parent 1665088c76
commit a5f42a3e30

View File

@@ -18,7 +18,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
with:
ref: stage
ref: main
- name: Get the endpoint ID
# Usually ID is 1, but you can get it from the API. Only skip this if you are VERY sure.
@@ -34,10 +34,16 @@ jobs:
echo "STACK_ID=$STACK_ID" >> $GITHUB_ENV
echo "Got stack ID: $STACK_ID matched with Endpoint ID: $ENDPOINT_ID"
- name: Fetch Stack
run: |
# Get the stack details (including stack file content)
curl -s -H "X-API-Key: $PORTAINER_TOKEN" "$PORTAINER_API_URL/stacks/$STACK_ID/file" \
| jq -r '.StackFileContent' > stack.yml
- name: Update stack in Portainer
run: |
# Read stack file content
STACK_FILE_CONTENT=$(echo "$(<stage-compose.yml )")
STACK_FILE_CONTENT=$(echo "$(<stack.yml )")
# Prepare JSON payload
JSON_PAYLOAD=$(jq -n --arg stackFileContent "$STACK_FILE_CONTENT" --argjson pullImage true \