chore(deps): bump anchore/sbom-action from 0.20.0 to 0.20.1 #67
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: Set default values to PR | |
# Add the PR to the central project (status in project is set via workflow in project) | |
# Add the creator of the PR as assignee | |
# Add the next available milestone to the PR | |
on: | |
pull_request: | |
types: | |
- opened | |
permissions: | |
issues: write | |
pull-requests: write | |
jobs: | |
set-default-values: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Add PR to default project | |
uses: actions/add-to-project@v1.0.2 | |
with: | |
project-url: https://github.com/orgs/SAP/projects/72 | |
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }} | |
- name: Add creator as assignee | |
if: ${{ github.actor != 'dependabot[bot]' }} | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh api \ | |
--method POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
/repos/${{github.repository}}/issues/${{github.event.number}}/assignees \ | |
-f "assignees[]=${{github.actor}}" | |
- name: Add next milestone | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const milestones = await github.rest.issues.listMilestones({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
state: "open", | |
sort: "due_on", | |
direction: "asc" | |
}) | |
await github.rest.issues.update({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.issue.number, | |
milestone: milestones.data[0].number | |
}); | |
- name: Set default labels | |
if: ${{ github.actor != 'dependabot[bot]' }} | |
uses: actions/github-script@v7 | |
env: | |
TITLE: ${{ github.event.pull_request.title }} | |
with: | |
script: | | |
const title = process.env.TITLE; | |
let defaultLabels = []; | |
if (title.startsWith("feat:")) { | |
defaultLabels.push("enhancement"); | |
} else if (title.startsWith("fix:")) { | |
defaultLabels.push("bug"); | |
} else if (title.startsWith("docs:")) { | |
defaultLabels.push("documentation"); | |
} else if (title.startsWith("test:")) { | |
defaultLabels.push("test setup", "internal", "ignore-for-release"); | |
} else if (title.startsWith("refactor:")) { | |
defaultLabels.push("internal", "ignore-for-release", "refactoring"); | |
} else { | |
defaultLabels.push("internal", "ignore-for-release"); | |
} | |
await github.rest.issues.addLabels({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.issue.number, | |
labels: defaultLabels | |
}); |