diff --git a/.github/workflows/on-pr-closed.yml b/.github/workflows/on-pr-closed.yml deleted file mode 100644 index ed42165ef..000000000 --- a/.github/workflows/on-pr-closed.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: On PR Closed - Copy Issue Labels - -on: - pull_request: - types: - - closed - -jobs: - copy-labels: - name: Copy linked issue labels - runs-on: ubuntu-latest - steps: - - name: copy labels - env: - GITHUB_TOKEN: ${{ secrets.GH_CLI_TOKEN }} - PR_NUMBER: ${{ github.event.number }} - run: | - org=${{ github.repository_owner }} - repo=psibase - pr_number=$PR_NUMBER - issue_number=$(gh api graphql -F owner="$org" -F repo="$repo" -F pr=$pr_number -f query=' - query ($owner: String!, $repo: String!, $pr: Int!) { - repository(owner: $owner, name: $repo) { - pullRequest(number: $pr) { - closingIssuesReferences(first: 1) { - nodes { - number - } - } - } - } - }' --jq '.data.repository.pullRequest.closingIssuesReferences.nodes[].number') - - if [ -z "${issue_number}" ]; then - echo "No issue linked to this PR" - exit 0 - fi - - labels=$(gh api "repos/$org/$repo/issues/$issue_number/labels" --jq 'map(.name) | join(",")') - - if [ -z "${labels}" ]; then - echo "No labels on linked issue" - exit 0 - fi - - json_labels="[\"$(echo "$labels" | sed 's/,/","/g')\"]" - echo "{\"labels\":$json_labels}" > input.json - gh api "repos/$org/$repo/issues/$pr_number/labels" -X POST --input input.json - rm input.json