diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml new file mode 100644 index 00000000..d0b48d7a --- /dev/null +++ b/.github/workflows/testing.yml @@ -0,0 +1,31 @@ +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 + if: steps.first_issue_check.outputs.first_issue == 'true' + run: | + echo "This is the first issue. Congratulations!" + # Add your label adding logic here