From 830b062af3a2636e6a657ca2e7d6268a6d4fa2a2 Mon Sep 17 00:00:00 2001 From: Johanan Oppong Amoateng Date: Sun, 29 Sep 2024 19:47:52 +0000 Subject: [PATCH 1/6] Create a Comment Action for Automated Conference Issues #442 --- .github/workflows/conference.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/conference.yml b/.github/workflows/conference.yml index 59286be..a82e3d7 100644 --- a/.github/workflows/conference.yml +++ b/.github/workflows/conference.yml @@ -53,3 +53,20 @@ jobs: labels: | report automated pr + add_comment: + runs-on: ubuntu-latest + + steps: + - name: Add comment to the issue + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const issueNumber = context.payload.issue.number; + const comment = "Automated issue, no action is required." + + github.issues.createComment({ + ...context.repo, + issue_number: issueNumber, + body: comment + }); From 109fff362f546fd0190b849c556ebe669561fad6 Mon Sep 17 00:00:00 2001 From: Johanan Oppong Amoateng Date: Sun, 29 Sep 2024 19:51:56 +0000 Subject: [PATCH 2/6] adds comment only if the issue is created by a bot --- .github/workflows/conference.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/conference.yml b/.github/workflows/conference.yml index a82e3d7..2e534d0 100644 --- a/.github/workflows/conference.yml +++ b/.github/workflows/conference.yml @@ -59,6 +59,7 @@ jobs: steps: - name: Add comment to the issue uses: actions/github-script@v6 + if: ${{ github.event.issue.user.type != 'User' }} #adds comment only if the issue is created by a bot with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | From db153f7f440f512ccd8031b9c9a9550a3c58ca32 Mon Sep 17 00:00:00 2001 From: Johanan Oppong Amoateng Date: Sun, 29 Sep 2024 22:06:08 +0000 Subject: [PATCH 3/6] fixes --- .github/workflows/conference.yml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/conference.yml b/.github/workflows/conference.yml index 2e534d0..b07a8e5 100644 --- a/.github/workflows/conference.yml +++ b/.github/workflows/conference.yml @@ -55,19 +55,19 @@ jobs: automated pr add_comment: runs-on: ubuntu-latest - + steps: - - name: Add comment to the issue - uses: actions/github-script@v6 - if: ${{ github.event.issue.user.type != 'User' }} #adds comment only if the issue is created by a bot - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const issueNumber = context.payload.issue.number; - const comment = "Automated issue, no action is required." - - github.issues.createComment({ - ...context.repo, - issue_number: issueNumber, - body: comment - }); + - name: Add comment to the issue + uses: actions/github-script@v6 + if: ${{ github.event.issue.user.type == 'User' && startsWith(github.event.issue.title, '[CONFERENCE]') && contains(github.event.issue.labels.*.name, 'conference') }} #adds comment only if the issue is created by a user + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const issueNumber = context.payload.issue.number; + const comment = "Automated issue, no action is required." + + github.issues.createComment({ + ...context.repo, + issue_number: issueNumber, + body: comment + }); From 8af2ee9bcab7ad81adcf1a9e7ed020587344a1d6 Mon Sep 17 00:00:00 2001 From: Johanan Oppong Amoateng Date: Sun, 29 Sep 2024 22:14:15 +0000 Subject: [PATCH 4/6] fixes --- .github/workflows/conference.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/conference.yml b/.github/workflows/conference.yml index b07a8e5..7860298 100644 --- a/.github/workflows/conference.yml +++ b/.github/workflows/conference.yml @@ -57,6 +57,26 @@ jobs: runs-on: ubuntu-latest steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + token: ${{ env.GITHUB_TOKEN }} + + - name: Setup Python environment + uses: actions/setup-python@v4 + with: + python-version: "3.11" + + - name: Install dependencies + run: pip install PyGithub PyYAML pre-commit + + - name: Run script + env: + GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }} + run: | + python _conferences + pre-commit run --all-files --show-diff-on-failure + - name: Add comment to the issue uses: actions/github-script@v6 if: ${{ github.event.issue.user.type == 'User' && startsWith(github.event.issue.title, '[CONFERENCE]') && contains(github.event.issue.labels.*.name, 'conference') }} #adds comment only if the issue is created by a user From 713d3c0027bfe0b3b13a07400895f18bbb9e857f Mon Sep 17 00:00:00 2001 From: Johanan Oppong Amoateng <88411614+JohananOppongAmoateng@users.noreply.github.com> Date: Wed, 2 Oct 2024 08:45:22 +0000 Subject: [PATCH 5/6] Update conference.yml --- .github/workflows/conference.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/conference.yml b/.github/workflows/conference.yml index 7860298..66d0c99 100644 --- a/.github/workflows/conference.yml +++ b/.github/workflows/conference.yml @@ -79,7 +79,7 @@ jobs: - name: Add comment to the issue uses: actions/github-script@v6 - if: ${{ github.event.issue.user.type == 'User' && startsWith(github.event.issue.title, '[CONFERENCE]') && contains(github.event.issue.labels.*.name, 'conference') }} #adds comment only if the issue is created by a user + if: ${{ github.event.action == 'opened' && startsWith(github.event.issue.title, '[CONFERENCE]') && contains(github.event.issue.labels.*.name, 'conference') }} #adds comment only if the issue is created by a user with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | From 0d10a58f67c16d7f585e395da28cf33f5cb6a109 Mon Sep 17 00:00:00 2001 From: Johanan Oppong Amoateng Date: Wed, 2 Oct 2024 10:09:09 +0000 Subject: [PATCH 6/6] fixes --- .github/workflows/scorecard.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 4ac8999..baf286b 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -10,9 +10,9 @@ on: # To guarantee Maintained check is occasionally updated. See # https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained schedule: - - cron: '22 15 * * 4' + - cron: "22 15 * * 4" push: - branches: [ "gh-pages" ] + branches: ["gh-pages"] # Declare default permissions as read only. permissions: read-all