From c6a456dbf4510f49f6ee979ae298319245e33239 Mon Sep 17 00:00:00 2001 From: Taiizor <41683699+Taiizor@users.noreply.github.com> Date: Fri, 23 Feb 2024 16:51:04 +0300 Subject: [PATCH] Create testing.yml --- .github/workflows/testing.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/testing.yml diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml new file mode 100644 index 00000000..75fea3cb --- /dev/null +++ b/.github/workflows/testing.yml @@ -0,0 +1,32 @@ +name: Congratulations and Label + +on: + issues: + types: [opened] + +jobs: + Congratulation-And-Label: + runs-on: ubuntu-latest + steps: + - name: Check if it's the first issue + id: first_issue_check + uses: actions/github-script@v4 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const { owner, repo } = context.repo; + const { data: issues } = await github.issues.listForRepo({ owner, repo }); + const issueCount = issues.length; + console.log(`Total issues: ${issueCount}`); + if (issueCount === 1) { + core.setOutput('first_issue', 'true'); + } else { + core.setOutput('first_issue', 'false'); + } + + - name: Congratulations message and label + if: steps.first_issue_check.outputs.first_issue == 'true' + run: | + echo "This is the first issue. Congratulations!" + # Adding a label + gh issue label add ${{ github.event.issue.number }} "good first issue"