-
Notifications
You must be signed in to change notification settings - Fork 7
ci: add Slack PR notification workflow #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
stevefulme1
wants to merge
9
commits into
redhat-cop:main
Choose a base branch
from
stevefulme1:slack-pr-notifications
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+117
−27
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
0f9c8a0
Update SECURITY.md with project-specific content
stevefulme1 b714c78
docs: standardize security policy to Ansible community standard
stevefulme1 464b4bc
docs: standardize contributing guide to Ansible community standard
stevefulme1 612ed3a
docs: standardize code of conduct to Ansible community standard
stevefulme1 a294bc5
docs: standardize license to GPL-3.0
stevefulme1 ed3b2ed
ci: add Slack PR notification workflow
stevefulme1 667af51
fix(ci): quote GITHUB_OUTPUT and consolidate redirects
stevefulme1 492b589
fix: address PR review feedback
stevefulme1 a9721b3
Merge branch 'main' into slack-pr-notifications
stevefulme1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,71 @@ | ||
| name: Slack PR Notifications | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, closed, reopened] | ||
| branches: ["main"] | ||
| pull_request_review: | ||
| types: [submitted] | ||
|
|
||
| jobs: | ||
| notify: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Set notification details | ||
| id: details | ||
| env: | ||
| EVENT_NAME: ${{ github.event_name }} | ||
| EVENT_ACTION: ${{ github.event.action }} | ||
| PR_TITLE: ${{ github.event.pull_request.title }} | ||
| PR_MERGED: ${{ github.event.pull_request.merged }} | ||
| PR_USER: ${{ github.event.pull_request.user.login }} | ||
| REVIEW_STATE: ${{ github.event.review.state }} | ||
| REVIEW_USER: ${{ github.event.review.user.login }} | ||
| run: | | ||
| if [[ "$EVENT_NAME" == "pull_request_review" ]]; then | ||
| TITLE="PR Review: ${REVIEW_STATE} - ${PR_TITLE}" | ||
| COLOR=$([[ "$REVIEW_STATE" == "approved" ]] && echo "good" || echo "warning") | ||
| BODY="${REVIEW_USER} ${REVIEW_STATE} the PR" | ||
| else | ||
| TITLE="PR ${EVENT_ACTION^}: ${PR_TITLE}" | ||
| if [[ "$EVENT_ACTION" == "closed" && "$PR_MERGED" == "true" ]]; then | ||
| TITLE="PR Merged: ${PR_TITLE}" | ||
| COLOR="good" | ||
| elif [[ "$EVENT_ACTION" == "opened" ]]; then | ||
| COLOR="#1a73e8" | ||
| elif [[ "$EVENT_ACTION" == "reopened" ]]; then | ||
| COLOR="warning" | ||
| else | ||
| COLOR="danger" | ||
| fi | ||
| BODY="${PR_USER} ${EVENT_ACTION} the PR" | ||
| fi | ||
|
|
||
| { | ||
| echo "title=${TITLE}" | ||
| echo "color=${COLOR}" | ||
| echo "body=${BODY}" | ||
| } >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Send Slack notification | ||
| uses: slackapi/slack-github-action@v2.1.0 | ||
| with: | ||
| webhook: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
| webhook-type: incoming-webhook | ||
| payload: | | ||
| { | ||
| "attachments": [ | ||
| { | ||
| "color": "${{ steps.details.outputs.color }}", | ||
| "blocks": [ | ||
| { | ||
| "type": "section", | ||
| "text": { | ||
| "type": "mrkdwn", | ||
| "text": "*${{ steps.details.outputs.title }}*\n${{ steps.details.outputs.body }}\n*Repo:* `${{ github.repository }}`\n*Branch:* `${{ github.event.pull_request.head.ref }}` -> `${{ github.event.pull_request.base.ref }}`\n<${{ github.event.pull_request.html_url }}|View Pull Request>" | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,4 +1,3 @@ | ||
| # Community Code of Conduct | ||
|
|
||
| Please see the official | ||
| [Ansible Community Code of Conduct](https://docs.ansible.com/ansible/latest/community/code_of_conduct.html). | ||
| Please see the official [Ansible Community Code of Conduct](https://docs.ansible.com/ansible/latest/community/code_of_conduct.html). |
This file contains hidden or 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,15 @@ | ||
| # Security Policy | ||
|
|
||
| ## Supported Versions | ||
|
|
||
| Ansible applies security fixes according to the 3-versions-back support | ||
| policy. Please find more information in [our docs]( | ||
| https://docs.ansible.com/ansible/devel/reference_appendices/release_and_maintenance.html#release-status | ||
| ). | ||
|
|
||
| ## Reporting a Vulnerability | ||
|
|
||
| We encourage responsible disclosure practices for security | ||
| vulnerabilities. Please read our [policies for reporting bugs]( | ||
| https://docs.ansible.com/ansible/devel/community/reporting_bugs_and_features.html#reporting-a-bug | ||
| ) if you want to report a security issue that might affect Ansible. |
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, add a link to this file in the repository README under the section
## DocumentationThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done — added SECURITY.md link to the README Documentation section.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something wrong happened with your last merge commit. The change in the main README was reverted back and we lost the link. Can you please add it again? Note that you should not add the link to SECURITY.md directly in the TOC. The TOC is automated. You should add the link under the section "## Documentation" like for the other files.