rectify the error #4
This file contains 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
name: "Github to Slack Notification" | |
on: | |
push: | |
branches: [ "main" ] | |
jobs: | |
job1: | |
runs-on: ubuntu-latest | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
steps: | |
# Notify Slack when the workflow starts | |
- uses: act10ns/slack@v2 | |
with: | |
status: starting | |
channel: '#github-to-slack-notification' | |
message: "Checking npm packages" | |
if: always() | |
# Checkout the repository | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
# Install npm dependencies | |
- name: Install Dependencies | |
run: npm install | |
# Check for outdated packages and capture output | |
- name: Check Outdated Packages | |
id: outdated-packages | |
run: | | |
npm outdated > outdated_packages.txt || echo "No outdated packages found" > outdated_packages.txt. | |
echo "outdated_packages=$OUTPUT" >> $GITHUB_ENV | |
# Save the result as an output variable | |
shell: bash | |
env: | |
OUTPUT_FILE: outdated_packages.txt | |
# Notify Slack with outdated packages | |
- name: Notify Slack - Outdated Packages | |
uses: act10ns/slack@v2 | |
with: | |
status: success | |
channel: '#github-to-slack-notification' | |
message: | | |
Following outdated packages found: | |
${{ env.outdated_packages }} | |
if: always() |