|
| 1 | +name: "Test - Max opened issues" |
| 2 | + |
| 3 | +on: |
| 4 | +# pull_request: {} |
| 5 | + workflow_dispatch: {} |
| 6 | + |
| 7 | +env: |
| 8 | + AWS_REGION: us-east-2 |
| 9 | + |
| 10 | +# Permissions required for assuming AWS identity |
| 11 | +permissions: |
| 12 | + id-token: write |
| 13 | + contents: read |
| 14 | + issues: write |
| 15 | + |
| 16 | +jobs: |
| 17 | + setup: |
| 18 | + runs-on: ubuntu-latest |
| 19 | + steps: |
| 20 | + - name: Setup |
| 21 | + run: echo "Do setup" |
| 22 | + |
| 23 | + - uses: actions/checkout@v4 |
| 24 | + with: |
| 25 | + ref: ${{ github.event.pull_request.head.ref }} |
| 26 | + |
| 27 | + - name: Upload Artifacts |
| 28 | + uses: actions/upload-artifact@v3 |
| 29 | + with: |
| 30 | + name: metadata |
| 31 | + path: ./tests/fixtures/metadata |
| 32 | + retention-days: 1 |
| 33 | + |
| 34 | + test: |
| 35 | + runs-on: ubuntu-latest |
| 36 | + continue-on-error: true |
| 37 | + needs: [setup] |
| 38 | + steps: |
| 39 | + - uses: actions/checkout@v4 |
| 40 | + with: |
| 41 | + ref: ${{ github.event.pull_request.head.ref }} |
| 42 | + |
| 43 | + - name: Plan Atmos Component |
| 44 | + id: current |
| 45 | + uses: ./ |
| 46 | + with: |
| 47 | + max-opened-issues: '3' |
| 48 | + labels: "test-max-opened-issues" |
| 49 | + token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }} |
| 50 | + |
| 51 | + outputs: |
| 52 | + result: ${{ steps.current.outcome }} |
| 53 | + |
| 54 | + assert: |
| 55 | + runs-on: ubuntu-latest |
| 56 | + needs: [test] |
| 57 | + steps: |
| 58 | + - uses: nick-fields/assert-action@v1 |
| 59 | + with: |
| 60 | + expected: 'success' |
| 61 | + actual: "${{ needs.test.outputs.result }}" |
| 62 | + |
| 63 | + - name: Find all issues |
| 64 | + id: issues |
| 65 | + uses: lee-dohm/select-matching-issues@v1 |
| 66 | + with: |
| 67 | + query: 'label:test-max-opened-issues is:open' |
| 68 | + token: ${{ github.token }} |
| 69 | + |
| 70 | + - name: Close found issues |
| 71 | + id: test |
| 72 | + run: | |
| 73 | + cat ${{ steps.issues.outputs.path }} |
| 74 | + echo "count=$(cat ${{ steps.issues.outputs.path }} | xargs -I {} -d '\n' echo "{}" | wc -l )" >> $GITHUB_OUTPUT |
| 75 | +
|
| 76 | + - uses: nick-fields/assert-action@v1 |
| 77 | + with: |
| 78 | + expected: '3' |
| 79 | + actual: "${{ steps.test.outputs.count }}" |
| 80 | + |
| 81 | + teardown: |
| 82 | + runs-on: ubuntu-latest |
| 83 | + needs: [assert] |
| 84 | + if: ${{ always() }} |
| 85 | + steps: |
| 86 | + - name: Tear down |
| 87 | + run: echo "Do Tear down" |
| 88 | + |
| 89 | + - name: Find all issues |
| 90 | + id: issues |
| 91 | + uses: lee-dohm/select-matching-issues@v1 |
| 92 | + with: |
| 93 | + query: 'label:test-max-opened-issues is:open' |
| 94 | + token: ${{ github.token }} |
| 95 | + |
| 96 | + - name: Close found issues |
| 97 | + run: cat ${{ steps.issues.outputs.path }} | xargs -I {} -d '\n' gh issue close {} |
| 98 | + env: |
| 99 | + GH_TOKEN: ${{ github.token }} |
0 commit comments