feat: add label management to Sisyphus workflow (#215)
- Add 'sisyphus: working' label when Sisyphus starts working on an issue/PR - Remove label when work completes (success or failure) - Label operations use gh CLI with idempotent commands - Handles both issues and PRs with proper conditional logic - Uses || true for error handling to prevent workflow failures Closes #202 Co-authored-by: sisyphus-dev-ai <sisyphus-dev-ai@users.noreply.github.com>
This commit is contained in:
54
.github/workflows/sisyphus-agent.yml
vendored
54
.github/workflows/sisyphus-agent.yml
vendored
@@ -243,6 +243,27 @@ jobs:
|
|||||||
gh api "/repos/${{ github.repository }}/issues/comments/${{ steps.context.outputs.comment_id }}/reactions" \
|
gh api "/repos/${{ github.repository }}/issues/comments/${{ steps.context.outputs.comment_id }}/reactions" \
|
||||||
-X POST -f content="eyes" || true
|
-X POST -f content="eyes" || true
|
||||||
|
|
||||||
|
- name: Add working label
|
||||||
|
if: steps.context.outputs.number != ''
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
|
||||||
|
run: |
|
||||||
|
gh label create "sisyphus: working" \
|
||||||
|
--repo "${{ github.repository }}" \
|
||||||
|
--color "fcf2e1" \
|
||||||
|
--description "Sisyphus is currently working on this" \
|
||||||
|
--force || true
|
||||||
|
|
||||||
|
if [[ "${{ steps.context.outputs.type }}" == "pr" ]]; then
|
||||||
|
gh pr edit "${{ steps.context.outputs.number }}" \
|
||||||
|
--repo "${{ github.repository }}" \
|
||||||
|
--add-label "sisyphus: working" || true
|
||||||
|
else
|
||||||
|
gh issue edit "${{ steps.context.outputs.number }}" \
|
||||||
|
--repo "${{ github.repository }}" \
|
||||||
|
--add-label "sisyphus: working" || true
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Run OpenCode
|
- name: Run OpenCode
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
|
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
|
||||||
@@ -286,19 +307,30 @@ jobs:
|
|||||||
git push origin "$BRANCH" || true
|
git push origin "$BRANCH" || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove :eyes:, add :+1:
|
- name: Update reaction and remove label
|
||||||
- name: Update reaction
|
if: always()
|
||||||
if: always() && steps.context.outputs.comment_id != ''
|
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
|
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
|
||||||
run: |
|
run: |
|
||||||
# Remove eyes
|
if [[ -n "${{ steps.context.outputs.comment_id }}" ]]; then
|
||||||
REACTION_ID=$(gh api "/repos/${{ github.repository }}/issues/comments/${{ steps.context.outputs.comment_id }}/reactions" \
|
REACTION_ID=$(gh api "/repos/${{ github.repository }}/issues/comments/${{ steps.context.outputs.comment_id }}/reactions" \
|
||||||
--jq '.[] | select(.content == "eyes" and .user.login == "sisyphus-dev-ai") | .id' | head -1)
|
--jq '.[] | select(.content == "eyes" and .user.login == "sisyphus-dev-ai") | .id' | head -1)
|
||||||
if [[ -n "$REACTION_ID" ]]; then
|
if [[ -n "$REACTION_ID" ]]; then
|
||||||
gh api -X DELETE "/repos/${{ github.repository }}/reactions/${REACTION_ID}" || true
|
gh api -X DELETE "/repos/${{ github.repository }}/reactions/${REACTION_ID}" || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
gh api "/repos/${{ github.repository }}/issues/comments/${{ steps.context.outputs.comment_id }}/reactions" \
|
||||||
|
-X POST -f content="+1" || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Add thumbs up
|
if [[ -n "${{ steps.context.outputs.number }}" ]]; then
|
||||||
gh api "/repos/${{ github.repository }}/issues/comments/${{ steps.context.outputs.comment_id }}/reactions" \
|
if [[ "${{ steps.context.outputs.type }}" == "pr" ]]; then
|
||||||
-X POST -f content="+1" || true
|
gh pr edit "${{ steps.context.outputs.number }}" \
|
||||||
|
--repo "${{ github.repository }}" \
|
||||||
|
--remove-label "sisyphus: working" || true
|
||||||
|
else
|
||||||
|
gh issue edit "${{ steps.context.outputs.number }}" \
|
||||||
|
--repo "${{ github.repository }}" \
|
||||||
|
--remove-label "sisyphus: working" || true
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user