Deny
- Alpha
In the Denied
state, we know that the issue has been denied and there is no
further action to take. This is one of the first states in the workflow where we
can perform an unguarded transition.
In our repository workflow, a request is transitioned to the Denied
state when
an authorized user comments on the request with .deny
. However, immediately
after reaching this state, we want to close the issue (moving it to the Closed
state). This is called an unguarded transition because there is no condition
that must be met before the transition occurs.
The actual implementation of this transition is up to you! There are a few recommendations to keep in mind:
completed
may be
misleading. Consider not_planned
instead.When a new repository request is denied, we want to close the issue and leave a comment for the user. We should also add an appropriate label so we know the request was closed as denied.
# This job is responsible for handling denied requests.
deny:
name: Deny Request
runs-on: ubuntu-latest
# Only run after validation has completed.
needs: validate
steps:
- name: Deny Command
id: deny
uses: github/command@vX.X.X
with:
allowed_contexts: issue
allowlist: octo-org/approvers
allowlist_pat: ${{ secrets.MY_TOKEN }}
command: .deny
# Comment on the issue to let the user know their request was denied.
- if: ${{ steps.deny.outputs.continue == 'true' }}
name: Post Comment
id: comment
uses: peter-evans/create-or-update-comment@vX.X.X
with:
issue-number: ${{ github.event.issue.number }}
body:
':no_entry_sign: This request has been denied! This issue will be
closed shortly.'
# Close the issue.
- if: ${{ steps.deny.outputs.continue == 'true' }}
name: Close Issue
id: close
run: gh issue close ${{ github.event.issue.number }} --reason not_planned
Your IssueOps workflow is officially complete! For the complete workflow files,
check out the
new-repository-request-example
directory.