Skip to content

Commit

Permalink
Add failure message in ChatOps build-command and Slash dispatcher (#3037
Browse files Browse the repository at this point in the history
)

* Update build-command.yml with message for failures and pull before creating commit

* Update slash-command-dispatch.yml with failure message

* Update CHANGELOG.md
  • Loading branch information
echoix authored Oct 23, 2023
1 parent 553362a commit 8fa7597
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/build-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ jobs:
> Running script `./build.sh`
- name: Run build script
run: ./build.sh
- run: git pull
- uses: stefanzweifel/git-auto-commit-action@v5
id: auto-commit-action
with:
Expand Down Expand Up @@ -111,3 +112,13 @@ jobs:
issue-number: ${{ github.event.inputs.issue-number }}
body: |
> Build command workflow completed without updating files.
- name: Add failure reaction
if: failure()
uses: peter-evans/create-or-update-comment@v3
with:
repository: ${{ github.event.inputs.repository }}
comment-id: ${{ github.event.comment.id }}
issue-number: ${{ github.event.inputs.issue-number }}
body: |
> Build command workflow failed.
reactions: -1
6 changes: 6 additions & 0 deletions .github/workflows/slash-command-dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ jobs:
actions: write # needed to launch a workflow_dispatch
pull-requests: write
steps:
- name: Create URL to the run output
id: vars
run: echo "run-url=https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" >> $GITHUB_OUTPUT
- name: Dump the event payload context
env:
EVENT_CONTEXT: ${{ toJson(github.event) }}
Expand Down Expand Up @@ -71,3 +74,6 @@ jobs:
with:
comment-id: ${{ github.event.comment.id }}
reactions: -1
body: |
> Command dispatch failed.
> [Command run output](${{ steps.vars.outputs.run-url }})
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Note: Can be used with `oxsecurity/megalinter@beta` in your GitHub Action mega-l
- Free disk space earlier in the process to avoid failure during docker build
- Set flavors-stats.json as a generated file in .gitattributes ([#3023](https://github.com/oxsecurity/megalinter/pull/3023))
- Update and fix our ChatOps automations to only run on pull request comments, by @echoix in [#3034](https://github.com/oxsecurity/megalinter/pull/3034)
- Add failure message in ChatOps build-command and Slash dispatcher, by @echoix in [#3037](https://github.com/oxsecurity/megalinter/pull/3037)

- Linter versions upgrades
- [cfn-lint](https://github.com/aws-cloudformation/cfn-lint) from 0.80.2 to **0.80.3** on 2023-09-24
Expand Down

0 comments on commit 8fa7597

Please sign in to comment.