From cac72c2965e5f532c61d109af763127e10033b58 Mon Sep 17 00:00:00 2001 From: benStre Date: Wed, 17 Jan 2024 19:39:59 +0100 Subject: [PATCH] add workflow --- .github/workflows/update-prs.js | 22 ++++++++++++++++++++++ .github/workflows/update-prs.yml | 14 ++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 .github/workflows/update-prs.js create mode 100644 .github/workflows/update-prs.yml diff --git a/.github/workflows/update-prs.js b/.github/workflows/update-prs.js new file mode 100644 index 00000000..7e8225aa --- /dev/null +++ b/.github/workflows/update-prs.js @@ -0,0 +1,22 @@ +const owner = 'your_owner'; +const repo = 'your_repo'; +const accessToken = 'your_access_token'; + +const apiUrl = `https://api.github.com/repos/${owner}/${repo}/pulls`; + +try { + const response = await fetch(apiUrl, { + headers: { + Authorization: `Bearer ${accessToken}`, + }, + }); + + if (!response.ok) { + throw new Error(`Failed to fetch pull requests: ${response.statusText}`); + } + + const data = await response.json(); + console.log(data); +} catch (error) { + console.error(error); +} \ No newline at end of file diff --git a/.github/workflows/update-prs.yml b/.github/workflows/update-prs.yml new file mode 100644 index 00000000..da5062b1 --- /dev/null +++ b/.github/workflows/update-prs.yml @@ -0,0 +1,14 @@ +on: + push: + + +jobs: + trigger-pr-update: + runs-on: ubuntu-latest + + steps: + - name: Setup Node.js + uses: actions/setup-node@v3 + + - name: Run JavaScript file + run: node ./update-prs.js