Bump ossf/scorecard-action from 2.3.3 to 2.4.0 #105
Workflow file for this run
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: Set Labels on Pull Request | |
on: | |
pull_request: | |
types: | |
- closed | |
permissions: | |
contents: read | |
issues: write | |
pull-requests: write | |
discussions: write | |
jobs: | |
set-label-on-merge: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@c95a14d0e5bab51a9f56296a4eb0e416910cd350 # v2.10.3 | |
with: | |
egress-policy: audit | |
- name: Set Label on Merge | |
if: ${{ github.event.pull_request.merged }} | |
# if: steps.pr_outcome.outputs.pr_outcome == 'true' | |
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const prNumber = context.payload.pull_request.number; | |
await github.rest.issues.addLabels({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: prNumber, | |
labels: ['PR: released'] | |
}); | |
const pullRequestLabels = await github.rest.issues.listLabelsOnIssue({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: prNumber | |
}); | |
const labelNames = pullRequestLabels.data.map(label => label.name); | |
if (labelNames.includes('in progress')) { | |
await github.rest.issues.removeLabel({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: prNumber, | |
name: 'in progress' | |
}); | |
} | |
if (labelNames.includes('wait')) { | |
await github.rest.issues.removeLabel({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: prNumber, | |
name: 'wait' | |
}); | |
} | |
set-label-on-reject: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@c95a14d0e5bab51a9f56296a4eb0e416910cd350 # v2.10.3 | |
with: | |
egress-policy: audit | |
- name: Set Label on Reject | |
# if: steps.pr_outcome.outputs.pr_outcome != 'true' | |
if: ${{ !github.event.pull_request.merged }} | |
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const prNumber = context.payload.pull_request.number; | |
await github.rest.issues.addLabels({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: prNumber, | |
name: 'PR: rejected' | |
}); | |
const pullRequestLabels = await github.rest.issues.listLabelsOnIssue({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: prNumber | |
}); | |
const labelNames = pullRequestLabels.data.map(label => label.name); | |
if (labelNames.includes('in progress')) { | |
await github.rest.issues.removeLabel({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: prNumber, | |
name: 'in progress' | |
}); | |
} | |
if (labelNames.includes('wait')) { | |
await github.rest.issues.removeLabel({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: prNumber, | |
name: 'wait' | |
}); | |
} |