Skip to content

Commit

Permalink
Try to delete label
Browse files Browse the repository at this point in the history
  • Loading branch information
pitag-ha committed Dec 17, 2023
1 parent 740fc2c commit d53d571
Showing 1 changed file with 13 additions and 31 deletions.
44 changes: 13 additions & 31 deletions .github/workflows/workflow_triggered_by_workflow_run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,42 +14,24 @@ jobs:
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: Print pull_request context
run: |
echo "${{ toJson(github.event.workflow_run) }}"
- name: all_artifacts
run: |
curl -sSL "$GH_API_ACTIONS/runs/${{ github.event.workflow_run.id }}/artifacts"
- name: Filtered artifacts
run: |
all_artifacts=$(curl -sSL "$GH_API_ACTIONS/runs/${{ github.event.workflow_run.id }}/artifacts")
echo $all_artifacts | jq '.artifacts[] | select(.workflow_run.id == ${{ github.event.workflow_run.id }} and .name == "forwarded_instructions")'
- name: id
run: |
all_artifacts=$(curl -sSL "$GH_API_ACTIONS/runs/${{ github.event.workflow_run.id }}/artifacts")
forward_artifact=$(echo $all_artifacts | jq '.artifacts[] | select(.workflow_run.id == ${{ github.event.workflow_run.id }} and .name == "forwarded_instructions")')
echo $forward_artifact | jq -r '.id'
- name: endpoint
run: |
all_artifacts=$(curl -sSL "$GH_API_ACTIONS/runs/${{ github.event.workflow_run.id }}/artifacts")
forward_artifact=$(echo $all_artifacts | jq '.artifacts[] | select(.workflow_run.id == ${{ github.event.workflow_run.id }} and .name == "forwarded_instructions")')
id=$(echo $forward_artifact | jq -r '.id')
echo "$GH_API_ACTIONS/artifacts/$id/zip"
- name: Download artifact
- name: Download instruction artifact
run: |
all_artifacts=$(curl -sSL "$GH_API_ACTIONS/runs/${{ github.event.workflow_run.id }}/artifacts")
forward_artifact=$(echo $all_artifacts | jq '.artifacts[] | select(.workflow_run.id == ${{ github.event.workflow_run.id }} and .name == "forwarded_instructions")')
id=$(echo $forward_artifact | jq -r '.id')
curl -sSLO -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "$GH_API_ACTIONS/artifacts/$id/zip" -D headers.txt
- name: Print headers
run: |
cat headers.txt
- name: Ls
run: |
ls -la
- name: Unzip artifact
run: |
unzip -q zip -d forward || cat zip
- name: Cat the artifact content
unzip -q zip -d forward || (cat zip && cat headers.txt)
- name: Retreive instruction contents
id: instruction
run: |
echo "instruction=$(jq '.instruction' forward/instruction.json) | tee -a $GITHUB_OUTPUT
echo "endpoint=$(jq '.endpoint' forward/instruction.json) | tee -a $GITHUB_OUTPUT
- name: Delete the label
if: steps.instruction.outputs.instruction == 'delete_label'
run: |
cat forward/instruction.json
LABEL_NAME=$(cat .github/workflows/fuzzy-ci-helpers/label_name.txt)
curl -sL -w "%{http_code}" -o output.txt -X DELETE -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "${{ steps.instruction.outputs.endpoint }}/$LABEL_NAME"
- name: Print http code
run: cat output.txt

0 comments on commit d53d571

Please sign in to comment.