Skip to content

Commit

Permalink
-wip- test upload and download artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaurello committed Jan 24, 2024
1 parent fc7505e commit b11375a
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
17 changes: 16 additions & 1 deletion .github/workflows/xcm-wss-endpoints-monitor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,20 @@ jobs:
- name: 🛠️ Build
run: npm run build

- name: 📜 Download existing script output
uses: actions/download-artifact@v4
with:
name: inactive-endpoints
- name: Display structure of downloaded files
run: ls -R

- name: 💻 Run script
run: npx bun ./scripts/check-websockets.ts --slack-wh=${{ secrets.SLACK_WEBHOOK_URL }}
# run: npx bun ./scripts/check-websockets.ts --slack-wh=${{ secrets.SLACK_WEBHOOK_URL }}
run: npx bun ./scripts/check-websockets.ts

- name: 📦 Upload script output
uses: actions/upload-artifact@v4
with:
name: inactive-endpoints
path: ./scripts/check-websockets-output.json
retention-days: 1
22 changes: 21 additions & 1 deletion scripts/check-websockets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/* eslint-disable no-console */
import { chainsList } from '@moonbeam-network/xcm-config';
import { IncomingWebhook } from '@slack/webhook';
import { readFile, writeFile } from 'fs';
import WebSocket from 'ws';

function procesArgs() {
Expand Down Expand Up @@ -65,7 +66,7 @@ interface ChainEndpoint {

const filteredChainList = incudeTestChains
? chainsList
: chainsList.filter((chain) => !chain.isTestChain);
: chainsList.filter((chain) => !chain.isTestChain && chain.key === 'acala');

const websocketEndpoints = filteredChainList.map(({ key, ws }) => ({
chainKey: key,
Expand Down Expand Up @@ -97,4 +98,23 @@ checkWebSocketEndpoints(websocketEndpoints).then(async (results) => {
console.warn('Slack webhook not detected, notification not sent');
}
}

const testJson = {
mangata: 1,
};
readFile('check-websockets-output.json', 'utf8', (err, data) => {
if (err) {
console.log('no file read');
} else {
console.log('reading file', data);
}
});
writeFile(
'check-websockets-output.json',
JSON.stringify(testJson),
'utf8',
() => {
console.log('file stored');
},
);
});

0 comments on commit b11375a

Please sign in to comment.