mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-07-24 13:01:56 +00:00
52 lines
1.6 KiB
YAML
52 lines
1.6 KiB
YAML
name: 'Tools: Lock Issue on Close'
|
|
|
|
on:
|
|
issues:
|
|
types:
|
|
- closed
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.issue.number }}
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
lock:
|
|
if: |
|
|
github.repository == 'prowler-cloud/prowler' &&
|
|
github.event.issue.locked == false
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 5
|
|
permissions:
|
|
issues: write
|
|
steps:
|
|
- name: Harden Runner
|
|
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
|
|
with:
|
|
egress-policy: block
|
|
allowed-endpoints: >
|
|
api.github.com:443
|
|
|
|
- name: Comment and lock issue
|
|
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
|
|
with:
|
|
script: |
|
|
const { owner, repo } = context.repo;
|
|
const issue_number = context.payload.issue.number;
|
|
|
|
try {
|
|
await github.rest.issues.createComment({
|
|
owner,
|
|
repo,
|
|
issue_number,
|
|
body: 'This issue is now locked as it has been closed. If you are still hitting a related problem, please open a new issue and link back to this one for context. Thanks!'
|
|
});
|
|
} catch (error) {
|
|
core.warning(`Failed to post lock comment on issue #${issue_number}: ${error.message}`);
|
|
}
|
|
|
|
const lockParams = { owner, repo, issue_number };
|
|
if (context.payload.issue.state_reason === 'completed') {
|
|
lockParams.lock_reason = 'resolved';
|
|
}
|
|
await github.rest.issues.lock(lockParams);
|