Skip to content

Commit

Permalink
update gh workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
scripthunter7 committed Sep 11, 2024
1 parent d17a55b commit 98ed01b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 27 deletions.
28 changes: 12 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Github Release

env:
NODE_VERSION: 18
NODE_VERSION: 20

# Workflow need write access to the repository to create a GitHub release
permissions:
Expand Down Expand Up @@ -32,10 +32,10 @@ jobs:
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Check out the repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: https://registry.npmjs.org
Expand Down Expand Up @@ -64,26 +64,22 @@ jobs:

notify:
name: Send Slack notification
needs:
- release

needs: release
# Note: 'always()' is needed to run the notify job even if the test job was failed
if:
${{ always() &&
(
github.event_name == 'push' ||
github.event_name == 'workflow_dispatch'
)
${{
always() &&
github.repository == 'AdguardTeam/Scriptlets' &&
(github.event_name == 'push' || github.event_name == 'workflow_dispatch')
}}
runs-on: ubuntu-latest
steps:
- name: Conclusion
uses: technote-space/workflow-conclusion-action@v3

- name: Send Slack notification
uses: 8398a7/action-slack@v3
with:
status: ${{ env.WORKFLOW_CONCLUSION }}
fields: workflow, repo, message, commit, author, eventName, ref
status: ${{ needs.release.result }}
fields: workflow, repo, message, commit, author, eventName, ref, job
job_name: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
26 changes: 15 additions & 11 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Test Scriptlets

env:
NODE_VERSION: 18
NODE_VERSION: 20

on:
push:
Expand All @@ -15,9 +15,9 @@ jobs:

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use Node.jobs
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}

Expand All @@ -34,25 +34,29 @@ jobs:
run: yarn build

notify:
needs:
- build

name: Send Slack notification on failure
needs: build
# Run this job only if the previous job failed and the event was triggered by the 'AdguardTeam/AGLint' repository
# Note: 'always()' is needed to run the notify job even if the test job was failed
if:
${{ always() &&
${{
always() &&
needs.check_code.result == 'failure' &&
github.repository == 'AdguardTeam/Scriptlets' &&
(
github.event_name == 'push' ||
github.event_name == 'workflow_dispatch' ||
github.event.pull_request.head.repo.full_name == github.repository
)
}}
runs-on: ubuntu-latest
steps:
- name: Conclusion
uses: technote-space/workflow-conclusion-action@v3
- name: Send Slack notification
uses: 8398a7/action-slack@v3
with:
status: ${{ env.WORKFLOW_CONCLUSION }}
fields: workflow, repo, message, commit, author, eventName, ref
status: failure
fields: workflow, repo, message, commit, author, eventName, ref, job
job_name: check_code
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

0 comments on commit 98ed01b

Please sign in to comment.