-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
21 lines (16 loc) · 747 Bytes
/
Copy pathindex.js
File metadata and controls
21 lines (16 loc) · 747 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const core = require('@actions/core');
const axios = require('axios');
async function run() {
try {
const apiKey = core.getInput('postman_api_key');
const collectionId = core.getInput('collection_id');
const collectionData = core.getInput('collection_data');
const response = await axios.put(`https://api.getpostman.com/collections/${collectionId}`, { 'collection': JSON.parse(collectionData) }, {
headers: { 'X-Api-Key': apiKey, 'Content-Type': 'application/json' }
});
console.log("Collection updated successfully:", JSON.stringify(response.data));
} catch (error) {
core.setFailed(`Error updating collection: ${error.response ? JSON.stringify(error.response.data) : error.message}`);
}
}
run();