Skip to content

Commit

Permalink
Merge pull request containers#19691 from cevich/lock_closed_issues
Browse files Browse the repository at this point in the history
[skip-ci] Lock closed issues and PRs
  • Loading branch information
openshift-merge-robot authored Aug 22, 2023
2 parents 260adf5 + f0e8e79 commit 5e295a9
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 0 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/discussion_lock.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
---

# Format ref: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions

name: "Lock closed Issue/PR discussions"

on:
schedule:
- cron: '0 0 * * *'
# Allow re-use of this workflow by other repositories
# Ref: https://docs.github.com/en/actions/using-workflows/reusing-workflows
workflow_call:
secrets:
ACTION_MAIL_SERVER:
required: true
ACTION_MAIL_USERNAME:
required: true
ACTION_MAIL_PASSWORD:
required: true
ACTION_MAIL_SENDER:
required: true
# Debug: Allow triggering job manually in github-actions WebUI
workflow_dispatch: {}

permissions:
contents: read

concurrency:
group: lock

env:
# Number of days befor a closed issue/PR is be comment-locked.
# Note: dessant/lock-threads will only process a max. of
# 50 issues/PRs at a time.
CLOSED_DAYS: 1825
# Pre-created issue/PR label to add (preferrably a bright color).
# This is intended to direct a would-be commenter's actions.
LOCKED_LABEL: 'locked - please file new issue/PR'

jobs:
closed_issue_discussion_lock:
name: "Lock closed Issue/PR discussions"
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
# Ref: https://github.com/dessant/lock-threads#usage
- uses: dessant/lock-threads@v4
with:
issue-inactive-days: '${{env.CLOSED_DAYS}}'
pr-inactive-days: '${{env.CLOSED_DAYS}}'
add-issue-labels: '${{env.LOCKED_LABEL}}'
add-pr-labels: '${{env.LOCKED_LABEL}}'
pr-lock-reason: 'resolved'
log-output: true
# Test the failure-notification step functions on failure
- run: |
echo "::warning::Initiating job test-failure to prompt a human to verify this is working and some issues/PRs were locked."
false
- if: failure()
name: Send job failure notification e-mail
uses: dawidd6/[email protected]
with:
server_address: ${{secrets.ACTION_MAIL_SERVER}}
server_port: 465
username: ${{secrets.ACTION_MAIL_USERNAME}}
password: ${{secrets.ACTION_MAIL_PASSWORD}}
subject: Github workflow error on ${{github.repository}}
to: [email protected],[email protected]
from: ${{secrets.ACTION_MAIL_SENDER}}
body: |
Job test-failed - https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
Please verify some issues/PRs were locked, then revert the commit which added this check.
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ to see if someone else has already reported it. If so, feel free to add
your scenario, or additional information, to the discussion. Or simply
"subscribe" to it to be notified when it is updated.

Note: Older closed issues/PRs are automatically locked, if you have a similar
problem please open a new issue instead of commenting.

If you find a new issue with the project we'd love to hear about it! The most
important aspect of a bug report is that it includes enough information for
us to reproduce it. To make this easier, there are three types of issue
Expand Down

0 comments on commit 5e295a9

Please sign in to comment.