generated from ergebnis/php-package-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from ergebnis/feature/reuse
Enhancement: Reuse composite actions from `ergebnis/.github`
- Loading branch information
Showing
3 changed files
with
8 additions
and
117 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,81 +25,23 @@ jobs: | |
steps: | ||
- name: "Request review from @ergebnis-bot" | ||
uses: "actions/github-script@v5" | ||
uses: "ergebnis/.github/actions/github/pull-request/[email protected]" | ||
with: | ||
github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" | ||
script: | | ||
const pullRequest = context.payload.workflow_run.pull_requests[0]; | ||
const reviewers = [ | ||
"ergebnis-bot", | ||
]; | ||
try { | ||
await github.rest.pulls.requestReviewers({ | ||
owner: context.repo.owner, | ||
pull_number: pullRequest.number, | ||
repo: context.repo.repo, | ||
reviewers: reviewers, | ||
}); | ||
} catch (error) { | ||
core.setFailed(error.message); | ||
} | ||
reviewer: "ergebnis-bot" | ||
|
||
- name: "Assign @ergebnis-bot" | ||
uses: "actions/github-script@v5" | ||
uses: "ergebnis/.github/actions/github/pull-request/[email protected]" | ||
with: | ||
github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" | ||
script: | | ||
const pullRequest = context.payload.workflow_run.pull_requests[0]; | ||
const assignees = [ | ||
"ergebnis-bot", | ||
]; | ||
try { | ||
await github.rest.issues.addAssignees({ | ||
assignees: assignees, | ||
issue_number: pullRequest.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
}); | ||
} catch (error) { | ||
core.setFailed(error.message); | ||
} | ||
assignee: "ergebnis-bot" | ||
|
||
- name: "Approve pull request" | ||
uses: "actions/github-script@v5" | ||
uses: "ergebnis/.github/actions/github/pull-request/[email protected]" | ||
with: | ||
github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" | ||
script: | | ||
const pullRequest = context.payload.workflow_run.pull_requests[0]; | ||
try { | ||
await github.rest.pulls.createReview({ | ||
event: "APPROVE", | ||
owner: context.repo.owner, | ||
pull_number: pullRequest.number, | ||
repo: context.repo.repo, | ||
}); | ||
} catch (error) { | ||
core.setFailed(error.message); | ||
} | ||
|
||
- name: "Merge pull request" | ||
uses: "actions/github-script@v5" | ||
uses: "ergebnis/.github/actions/github/pull-request/[email protected]" | ||
with: | ||
github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" | ||
script: | | ||
const pullRequest = context.payload.workflow_run.pull_requests[0]; | ||
try { | ||
await github.rest.pulls.merge({ | ||
merge_method: "merge", | ||
owner: context.repo.owner, | ||
pull_number: pullRequest.number, | ||
repo: context.repo.repo, | ||
}); | ||
} catch (error) { | ||
core.setFailed(error.message); | ||
} |
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 |
---|---|---|
|
@@ -14,24 +14,7 @@ jobs: | |
runs-on: "ubuntu-latest" | ||
|
||
steps: | ||
- name: "Determine tag" | ||
run: "echo \"RELEASE_TAG=${GITHUB_REF#refs/tags/}\" >> $GITHUB_ENV" | ||
|
||
- name: "Create release" | ||
uses: "actions/github-script@v5" | ||
uses: "ergebnis/.github/actions/github/release/[email protected]" | ||
with: | ||
github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" | ||
script: | | ||
try { | ||
await github.rest.repos.createRelease({ | ||
draft: false, | ||
generate_release_notes: true, | ||
name: process.env.RELEASE_TAG, | ||
owner: context.repo.owner, | ||
prerelease: false, | ||
repo: context.repo.repo, | ||
tag_name: process.env.RELEASE_TAG, | ||
}); | ||
} catch (error) { | ||
core.setFailed(error.message); | ||
} |
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 |
---|---|---|
|
@@ -15,40 +15,6 @@ jobs: | |
|
||
steps: | ||
- name: "Add labels based on branch name" | ||
uses: "actions/github-script@v5" | ||
uses: "ergebnis/.github/actions/github/pull-request/[email protected]" | ||
with: | ||
github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" | ||
script: | | ||
const branchPrefixLabels = { | ||
feature: "enhancement", | ||
fix: "bug", | ||
}; | ||
const pullRequest = context.payload.pull_request; | ||
const branchName = pullRequest.head.ref; | ||
const matches = branchName.match(new RegExp('^([^/]+)\/')); | ||
if (!matches instanceof Array) { | ||
return; | ||
} | ||
if (!branchPrefixLabels.hasOwnProperty(matches[1])) { | ||
return; | ||
} | ||
const label = branchPrefixLabels[matches[1]]; | ||
try { | ||
await github.rest.issues.addLabels({ | ||
issue_number: pullRequest.number, | ||
labels: [ | ||
label, | ||
], | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
}); | ||
} catch (error) { | ||
core.setFailed(error.message); | ||
} |