[#6626] Pin Open Klant Client to v0.8.0 #3235
Workflow file for this run
This file contains hidden or 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: Sync needs-backport label | |
| on: | |
| pull_request: | |
| types: | |
| - opened | |
| - edited | |
| - synchronized | |
| - reopened | |
| permissions: {} | |
| jobs: | |
| sync-label: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| issues: read | |
| pull-requests: write | |
| steps: | |
| - name: Get linked issues via GraphQL | |
| id: check | |
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 | |
| with: | |
| script: | | |
| const prNumber = context.payload.pull_request.number; | |
| const query = ` | |
| query($owner: String!, $repo: String!, $prNumber: Int!) { | |
| repository(owner: $owner, name: $repo) { | |
| pullRequest(number: $prNumber) { | |
| closingIssuesReferences(first: 10) { | |
| nodes { | |
| number | |
| labels(first: 20) { | |
| nodes { | |
| name | |
| } | |
| } | |
| } | |
| } | |
| labels(first: 20) { | |
| nodes { | |
| name | |
| } | |
| } | |
| } | |
| } | |
| } | |
| `; | |
| const result = await github.graphql(query, { | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| prNumber: prNumber | |
| }); | |
| const closingIssues = result.repository.pullRequest.closingIssuesReferences.nodes; | |
| const prLabels = result.repository.pullRequest.labels.nodes.map(l => l.name); | |
| const hasBackportLabel = prLabels.includes("needs-backport"); | |
| const anyIssueNeedsBackport = closingIssues.some(issue => | |
| issue.labels.nodes.some(label => label.name === "needs-backport") | |
| ); | |
| core.setOutput("shouldAddLabel", !hasBackportLabel && anyIssueNeedsBackport); | |
| - name: Add "needs-backport" label to PR | |
| if: steps.check.outputs.shouldAddLabel == 'true' | |
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 | |
| with: | |
| script: | | |
| await github.rest.issues.addLabels({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.payload.pull_request.number, | |
| labels: ['needs-backport'] | |
| }); | |
| console.log('Added "needs-backport" label to PR.'); |