Remove dist label #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Remove dist label | |
on: | |
workflow_run: | |
workflows: [Refresh dist files] | |
types: [completed] | |
jobs: | |
unlabel: | |
runs-on: ubuntu-latest | |
steps: | |
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#using-data-from-the-triggering-workflow | |
- name: Get PR URL artifact | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
run_id: context.payload.workflow_run.id, | |
}); | |
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { | |
return artifact.name == "pr_url" | |
})[0]; | |
console.log(matchArtifact); | |
let download = await github.rest.actions.downloadArtifact({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
artifact_id: matchArtifact.id, | |
archive_format: 'zip', | |
}); | |
let fs = require('fs'); | |
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/pr_url.zip`, Buffer.from(download.data)); | |
- run: unzip -p pr_url.zip | |
- run: unzip -l pr_url.zip | |
- run: gh pr edit "$(unzip -p pr_url.zip)" --remove-label "refresh dist" | |
env: | |
GH_TOKEN: ${{ github.token }} |