From d12bec3d6b7bae3fecd3fdc9b465a380532879df Mon Sep 17 00:00:00 2001 From: Bhavdeep13 Date: Mon, 22 Jul 2024 17:20:05 +0000 Subject: [PATCH 1/5] feat: Setup Dependabot workflow --- .github/dependabot.yml | 14 +++++++++ .../workflows/dependabot-issue-creator.yml | 29 +++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/dependabot-issue-creator.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..2794417 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,14 @@ +version: 2 +updates: + - package-ecosystem: "pip" + directory: "/backend/api/requirements.txt" + schedule: + interval: "weekly" + - package-ecosystem: "pip" + directory: "/backend/gateway/requirements.txt" + schedule: + interval: "weekly" + - package-ecosystem: "npm" + directory: "/frontend/package-lock.json" + schedule: + interval: "weekly" diff --git a/.github/workflows/dependabot-issue-creator.yml b/.github/workflows/dependabot-issue-creator.yml new file mode 100644 index 0000000..660245f --- /dev/null +++ b/.github/workflows/dependabot-issue-creator.yml @@ -0,0 +1,29 @@ +name: Dependabot Issue Creator + +on: + pull_request: + types: + - opened + - synchronize + +jobs: + create_issue: + runs-on: ubuntu-latest + if: github.actor == 'dependabot[bot]' + steps: + - name: Create issue + uses: actions/github-script@v5 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const pr = context.payload.pull_request; + const { title, html_url, number } = pr; + const issueTitle = `Dependency update: ${title}`; + const issueBody = `A new dependency update PR [#${number}](${html_url}) has been created. Please review and merge if appropriate.`; + const { data: issue } = await github.issues.create({ + owner: context.repo.owner, + repo: context.repo.repo, + title: issueTitle, + body: issueBody + }); + core.setOutput('issue_url', issue.html_url); From 980f58ce82ac3d60bcaa2efb76e193d09833d327 Mon Sep 17 00:00:00 2001 From: Bhavdeep13 Date: Mon, 22 Jul 2024 17:34:59 +0000 Subject: [PATCH 2/5] feat: Setup Dependabot workflow --- backend/api/requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/api/requirements.txt b/backend/api/requirements.txt index 70505ea..3c3cdb6 100644 --- a/backend/api/requirements.txt +++ b/backend/api/requirements.txt @@ -4,3 +4,4 @@ aiohttp==3.8.4 pydantic==1.10.7 redis==4.5.4 uvicorn==0.22.0 +requests==2.26.0 From c2b61892ba1cc0c5460fe938dd49e9345cc5a79d Mon Sep 17 00:00:00 2001 From: Bhavdeep13 Date: Mon, 22 Jul 2024 17:38:50 +0000 Subject: [PATCH 3/5] feat: Setup Dependabot workflow --- .github/workflows/dependabot-issue-creator.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/dependabot-issue-creator.yml b/.github/workflows/dependabot-issue-creator.yml index 660245f..ea80a40 100644 --- a/.github/workflows/dependabot-issue-creator.yml +++ b/.github/workflows/dependabot-issue-creator.yml @@ -9,7 +9,6 @@ on: jobs: create_issue: runs-on: ubuntu-latest - if: github.actor == 'dependabot[bot]' steps: - name: Create issue uses: actions/github-script@v5 From 4b31b9669fe04c58e8c5b41a12ab5a786c4604c0 Mon Sep 17 00:00:00 2001 From: Bhavdeep13 Date: Mon, 22 Jul 2024 17:41:51 +0000 Subject: [PATCH 4/5] feat: Setup Dependabot workflow --- .github/workflows/dependabot-issue-creator.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/dependabot-issue-creator.yml b/.github/workflows/dependabot-issue-creator.yml index ea80a40..f9bb07e 100644 --- a/.github/workflows/dependabot-issue-creator.yml +++ b/.github/workflows/dependabot-issue-creator.yml @@ -10,19 +10,34 @@ jobs: create_issue: runs-on: ubuntu-latest steps: + - name: Debug event + run: echo "${{ toJson(github.event) }}" + - name: Create issue uses: actions/github-script@v5 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | const pr = context.payload.pull_request; + if (!pr) { + core.setFailed('No pull request found in context payload.'); + return; + } + console.log('Pull Request:', pr); + const { title, html_url, number } = pr; const issueTitle = `Dependency update: ${title}`; const issueBody = `A new dependency update PR [#${number}](${html_url}) has been created. Please review and merge if appropriate.`; + + console.log('Creating issue with title:', issueTitle); + console.log('Creating issue with body:', issueBody); + const { data: issue } = await github.issues.create({ owner: context.repo.owner, repo: context.repo.repo, title: issueTitle, body: issueBody }); + + console.log('Issue created:', issue.html_url); core.setOutput('issue_url', issue.html_url); From 40b8d75eb8aa33a12d653520b373696e6e30ce2a Mon Sep 17 00:00:00 2001 From: Bhavdeep13 Date: Mon, 22 Jul 2024 17:45:20 +0000 Subject: [PATCH 5/5] feat: Setup Dependabot workflow --- .github/workflows/dependabot-issue-creator.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dependabot-issue-creator.yml b/.github/workflows/dependabot-issue-creator.yml index f9bb07e..39fa2ac 100644 --- a/.github/workflows/dependabot-issue-creator.yml +++ b/.github/workflows/dependabot-issue-creator.yml @@ -32,12 +32,12 @@ jobs: console.log('Creating issue with title:', issueTitle); console.log('Creating issue with body:', issueBody); - const { data: issue } = await github.issues.create({ + const issue = await github.rest.issues.create({ owner: context.repo.owner, repo: context.repo.repo, title: issueTitle, body: issueBody }); - console.log('Issue created:', issue.html_url); - core.setOutput('issue_url', issue.html_url); + console.log('Issue created:', issue.data.html_url); + core.setOutput('issue_url', issue.data.html_url);