generated from SAP/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e815df3
commit 3a9d6c8
Showing
3 changed files
with
65 additions
and
23 deletions.
There are no files selected for viewing
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
7 changes: 2 additions & 5 deletions
7
.github/workflows/assign-project.yml → ...hub/workflows/assign-issue-to-project.yml
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
|
||
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/[email protected] | ||
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 | ||
}); |