|
1 | | -# This workflow uses actions that are not certified by GitHub. |
2 | | -# They are provided by a third-party and are governed by |
3 | | -# separate terms of service, privacy policy, and support |
4 | | -# documentation. |
5 | | - |
6 | | -# GitHub recommends pinning actions to a commit SHA. |
7 | | -# To get a newer version, you will need to update the SHA. |
8 | | -# You can also reference a tag or branch, but the action may change without warning. |
9 | | - |
10 | | -name: Ruby |
11 | | - |
12 | | -env: |
13 | | - SECRETS_TOKEN: ${{ secrets.PAT }} |
| 1 | +name: CI Pipeline |
14 | 2 |
|
15 | 3 | on: |
16 | 4 | push: |
17 | | - branches: [ main, develop ] |
| 5 | + branches: |
| 6 | + - main |
18 | 7 | pull_request: |
19 | | - branches: [ main, develop ] |
20 | | - workflow_dispatch: |
| 8 | + branches: |
| 9 | + - main |
21 | 10 |
|
22 | 11 | jobs: |
23 | 12 | test: |
24 | 13 | runs-on: ubuntu-latest |
25 | | - |
| 14 | + |
26 | 15 | steps: |
27 | | - - name: Install my-app token |
28 | | - id: my-app |
29 | | - uses: getsentry/action-github-app-token@v3 |
30 | | - with: |
31 | | - app_id: ${{ secrets.APP_ID }} |
32 | | - private_key: ${{ secrets.APP_PRIVATE_KEY }} |
33 | | - - uses: actions/checkout@v4 |
34 | | - - name: Add outside users to organization |
35 | | - run: | |
36 | | - users=$(curl -L -s \ |
37 | | - -H "Accept: application/vnd.github+json" \ |
38 | | - -H "Authorization: Bearer ${{ steps.my-app.outputs.token }}" \ |
39 | | - -H "X-GitHub-Api-Version: 2022-11-28" \ |
40 | | - https://api.github.com/repos/${{ github.repository_owner }}/${{ github.event.repository.name }}/collaborators?affiliation=outside \ |
41 | | - | jq '.[] .id') |
42 | | - for user in $users |
43 | | - do |
44 | | - curl -s -L -o /dev/null \ |
45 | | - -X POST \ |
46 | | - -H "Accept: application/vnd.github+json" \ |
47 | | - -H "Authorization: Bearer ${{ steps.my-app.outputs.token }}" \ |
48 | | - -H "X-GitHub-Api-Version: 2022-11-28" \ |
49 | | - https://api.github.com/orgs/${{ github.repository_owner }}/invitations \ |
50 | | - -d "{\"invitee_id\": $user}" |
51 | | - done |
| 16 | + - name: Checkout code |
| 17 | + uses: actions/checkout@v4 |
| 18 | + |
| 19 | + - name: Authenticate with PAT |
| 20 | + env: |
| 21 | + GITHUB_TOKEN: ${{ secrets.PAT }} |
| 22 | + run: echo "Authenticated using PAT" |
| 23 | + |
52 | 24 | - name: Set up Ruby |
53 | 25 | uses: ruby/setup-ruby@v1 |
54 | 26 | with: |
55 | | - ruby-version: '3.2' |
56 | | - working-directory: '.github/tests' |
57 | | - bundler-cache: true |
| 27 | + ruby-version: 3.2 |
| 28 | + |
| 29 | + - name: Install dependencies |
| 30 | + run: bundle install |
| 31 | + |
58 | 32 | - name: Run tests |
59 | | - env: |
60 | | - URL: ${{ github.repository }} |
61 | | - TOKEN: ${{ steps.my-app.outputs.token }} |
62 | | - working-directory: '.github/tests' |
63 | | - run: |
64 | | - ruby test/script_test.rb |
| 33 | + run: bundle exec rspec |
0 commit comments