-
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Pavel Polyakov <djeredian@gmail.com>
- Loading branch information
Showing
9 changed files
with
416 additions
and
6 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 |
---|---|---|
@@ -0,0 +1,69 @@ | ||
name: "Documentation / Changelog" | ||
|
||
on: | ||
release: | ||
types: | ||
- released | ||
|
||
jobs: | ||
update: | ||
name: Update Changelog | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
# Give the default GITHUB_TOKEN write permission to commit and push the | ||
# updated CHANGELOG back to the repository. | ||
# https://github.blog/changelog/2023-02-02-github-actions-updating-the-default-github_token-permissions-to-read-only/ | ||
contents: write | ||
|
||
steps: | ||
- name: Generate token | ||
uses: tibdex/github-app-token@v2.1.0 | ||
id: generate_token | ||
with: | ||
app_id: ${{ secrets.APP_ID }} | ||
private_key: ${{ secrets.APP_PRIVATE_KEY }} | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
# Fetch entire history of repository to ensure release date can be | ||
# extracted from commit of the given tag. | ||
fetch-depth: 0 | ||
# Checkout target branch of this release. Ensures that the CHANGELOG | ||
# is not out of date. | ||
ref: ${{ github.event.release.target_commitish }} | ||
token: ${{ steps.generate_token.outputs.token }} | ||
|
||
- name: Extract release date from git tag | ||
id: release_date | ||
run: | | ||
echo "date=$(git log -1 --date=short --format=%ad '${{ github.event.release.tag_name }}')" >> $GITHUB_OUTPUT; | ||
- name: Update Changelog | ||
uses: stefanzweifel/changelog-updater-action@v1.10.0 | ||
with: | ||
# Pass extracted release date, release notes and version to the Action. | ||
release-date: ${{ steps.release_date.outputs.date }} | ||
release-notes: ${{ github.event.release.body }} | ||
latest-version: ${{ github.event.release.name }} | ||
parse-github-usernames: true | ||
|
||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v6.0.0 | ||
with: | ||
token: ${{ steps.generate_token.outputs.token }} | ||
branch: 'docs/update-changelog-${{ github.event.release.name }}' | ||
branch-suffix: short-commit-hash | ||
delete-branch: true | ||
draft: false | ||
committer: 'Print Maker Lab [bot] <831143+printmakerlab-bot[bot]@users.noreply.github.com>' | ||
author: 'Print Maker Lab [bot]' | ||
commit-message: 'docs(changelog): update changelog' | ||
signoff: true | ||
title: 'docs(changelog): update changelog' | ||
body: | | ||
Automated changelog PR for release: `${{ github.event.release.name }}` | ||
labels: | | ||
pull request: documentation | ||
pull request: skip-changelog |
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,26 @@ | ||
name: "Housekeeping / Stale" | ||
on: | ||
schedule: | ||
- cron: '0 8 * * *' | ||
|
||
jobs: | ||
comment: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/stale@v9.0.0 | ||
with: | ||
any-of-issue-labels: | ||
"status: waiting response,status: needs more info" | ||
only-pr-labels: '' | ||
stale-issue-message: | | ||
This issue has been marked as stale because it has required additional | ||
info or a response from the author for over 7 days. When you get the | ||
chance, please comment with the additional info requested. | ||
Otherwise, this issue will be closed in 7 days. | ||
close-issue-message: | | ||
This issue has been closed because it has received no activity for | ||
14 days. | ||
stale-issue-label: 'status: stale' | ||
days-before-stale: 7 | ||
days-before-close: 7 | ||
debug-only: true |
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,66 @@ | ||
name: "Issue / New issue triage" | ||
on: | ||
issues: | ||
types: [labeled, opened] | ||
|
||
permissions: | ||
issues: write | ||
|
||
jobs: | ||
add-comment-to-enhancement: | ||
name: "On enhancement" | ||
runs-on: ubuntu-latest | ||
if: ${{ contains(github.event.label.name, format('issue{0} enhancement', ':')) && contains(github.event.label.name, format('status{0} pending', ':')) }} | ||
steps: | ||
- name: Log github event | ||
env: | ||
$GITHUB_CONTEXT_LABELS: ${{ toJson(github.event.label) }} | ||
run: echo "$GITHUB_CONTEXT_LABELS" | ||
- name: Add comment | ||
uses: actions/github-script@v7.0.1 | ||
with: | ||
script: | | ||
github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: 'Thank you for submitting a feature request. Your proposal is open and will soon be reviewed by the Print Maker Lab team.<br><br>If your proposal is accepted and the Print Maker Lab team has bandwidth they will take on the issue, or else request you or other volunteers from the community to work on this issue.' | ||
}) | ||
add-comment-to-bug: | ||
name: "On bug report" | ||
runs-on: ubuntu-latest | ||
if: ${{ contains(github.event.label.name, format('issue{0} bug', ':')) && contains(github.event.label.name, format('status{0} pending', ':')) }} | ||
steps: | ||
- name: Log github event | ||
env: | ||
$GITHUB_CONTEXT_LABELS: ${{ toJson(github.event.label) }} | ||
run: echo "$GITHUB_CONTEXT_LABELS" | ||
- name: Add comment | ||
uses: actions/github-script@v7.0.1 | ||
with: | ||
script: | | ||
github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: 'Thank you for submitting a bug report. Your message will be reviewed shortly by the Print Maker Lab team.<br><br>If your request is reproducible and the Print Maker Lab team has the bandwidth, they will look into it, or ask you or other community volunteers to work on it.' | ||
}) | ||
add-comment-to-question: | ||
name: "On question" | ||
runs-on: ubuntu-latest | ||
if: ${{ contains(github.event.label.name, format('issue{0} question', ':')) && contains(github.event.label.name, format('status{0} pending', ':')) }} | ||
steps: | ||
- name: Log github event | ||
env: | ||
$GITHUB_CONTEXT_LABELS: ${{ toJson(github.event.label) }} | ||
run: echo "$GITHUB_CONTEXT_LABELS" | ||
- name: Add comment | ||
uses: actions/github-script@v7.0.1 | ||
with: | ||
script: | | ||
github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: 'Thank you for submitting your question. Your question will be reviewed shortly by the Print Maker Lab team.' | ||
}) |
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,35 @@ | ||
name: Project Automation / Issue | ||
on: | ||
issues: | ||
types: [opened, reopened, labeled] | ||
workflow_call: | ||
secrets: | ||
ADD_TO_PROJECT_PAT: | ||
required: true | ||
|
||
env: | ||
KANBAN_PROJECT_URL: https://github.com/orgs/PrintMakerLab/projects/3 | ||
TRACKER_PROJECT_URL: https://github.com/orgs/PrintMakerLab/projects/4 | ||
LABEL_BUG: 'issue: bug' | ||
LABEL_SECURITY: 'issue: security' | ||
LABEL_BACKLOG: 'status: backlog' | ||
|
||
jobs: | ||
add-to-kanban-project: | ||
name: Add security, bug and team selected issues to the Kanban project | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/add-to-project@v0.5.0 | ||
with: | ||
labeled: ${{ env.LABEL_BUG }}, ${{ env.LABEL_BACKLOG }}, ${{ env.LABEL_SECURITY }} | ||
project-url: ${{ env.KANBAN_PROJECT_URL }} | ||
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }} | ||
|
||
add-to-tracker-project: | ||
name: Add all issues to the Issue tracker project | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/add-to-project@v0.5.0 | ||
with: | ||
project-url: ${{ env.TRACKER_PROJECT_URL }} | ||
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }} |
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,21 @@ | ||
name: Project Automation / Pull Request | ||
on: | ||
pull_request_target: | ||
types: [opened, reopened] | ||
workflow_call: | ||
secrets: | ||
ADD_TO_PROJECT_PAT: | ||
required: true | ||
|
||
env: | ||
KANBAN_PROJECT_URL: https://github.com/orgs/PrintMakerLab/projects/3 | ||
|
||
jobs: | ||
add-to-kanban-project: | ||
name: Add all pull requests to the Kanban project | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/add-to-project@v0.5.0 | ||
with: | ||
project-url: ${{ env.KANBAN_PROJECT_URL }} | ||
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }} |
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,51 @@ | ||
name: "Pull request / Labels " | ||
|
||
on: | ||
pull_request_target: | ||
types: | ||
- opened | ||
- reopened | ||
- edited | ||
- synchronize | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number }} | ||
cancel-in-progress: true | ||
|
||
permissions: | ||
contents: read | ||
pull-requests: write | ||
|
||
jobs: | ||
label: | ||
if: github.event.pull_request.labels[0] == null | ||
name: "Assign labels" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Generate token | ||
uses: tibdex/github-app-token@v2.1.0 | ||
id: generate_token | ||
with: | ||
app_id: ${{ secrets.APP_ID }} | ||
private_key: ${{ secrets.APP_PRIVATE_KEY }} | ||
|
||
- name: "Apply label" | ||
uses: bcoe/conventional-release-labels@v1.3.1 | ||
with: | ||
token: ${{ steps.generate_token.outputs.token }} | ||
# Labels assigned based on pr name prefix | ||
type_labels: > | ||
{ | ||
"feat": "pull request: feature-minor", | ||
"fix": "pull request: bug", | ||
"build": "pull request: maintenance", | ||
"ci": "pull request: maintenance", | ||
"refactor": "pull request: maintenance", | ||
"test": "pull request: maintenance", | ||
"style": "pull request: maintenance", | ||
"translation": "pull request: translation", | ||
"docs": "pull request: documentation", | ||
"revert": "pull request: skip-changelog" | ||
} | ||
# Do not ignore any labels (default ignores chore:) | ||
ignored_types: '[]' |
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,50 @@ | ||
# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#force-deleting-cache-entries | ||
name: "Pull resquest / On Close" | ||
on: | ||
pull_request_target: | ||
types: | ||
- closed | ||
|
||
jobs: | ||
cleanup: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Cleanup up branch cache | ||
run: | | ||
gh extension install actions/gh-actions-cache | ||
echo "Fetching list of cache keys" | ||
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH -L 100 | cut -f 1 ) | ||
## Setting this to not fail the workflow while deleting cache keys. | ||
set +e | ||
echo "Deleting caches..." | ||
for cacheKey in $cacheKeysForPR | ||
do | ||
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm | ||
done | ||
echo "Done" | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
REPO: ${{ github.repository }} | ||
BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge | ||
if_merged: | ||
if: github.event.pull_request.merged == true | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Comment the schedule release | ||
id: conditional-comment | ||
uses: actions/github-script@v7.0.1 | ||
with: | ||
script: | | ||
const commentText = "The content of this pull request will be made available as part of our next release." | ||
github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: commentText | ||
}); | ||
- name: Set Output | ||
if: steps.conditional-comment.outcome == 'success' | ||
run: echo "Comment added successfully." |
29 changes: 23 additions & 6 deletions
29
...orkflows/validate_pull_request_labels.yml → ...kflows/pull-request-validation-labels.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
Oops, something went wrong.