Skip to content

Commit

Permalink
ci: confirm project actually linked in integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
dsanders11 committed Mar 13, 2024
1 parent 1532b39 commit b62ccce
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -244,22 +244,82 @@ jobs:

- name: Link Project to Repository
uses: ./link-project/
id: link-project-to-repo
if: ${{ matrix.owner == 'dsanders11' }}
with:
owner: ${{ steps.copy-project.outputs.owner }}
project-number: ${{ steps.copy-project.outputs.number }}
repository: dsanders11/project-actions
token: ${{ steps.get-auth-token.outputs.token }}

- name: Check Project is Linked to Repository
uses: ./github-script/
if: ${{ matrix.owner == 'dsanders11' }}
with:
token: ${{ steps.get-auth-token.outputs.token }}
script: |
const assert = require('node:assert');
const { projectV2 } = await github.graphql(
`query getProjectLinkedRepos($projectId: ID!) {
projectV2: node(id: $projectId) {
... on ProjectV2 {
id
repositories(first: 10) {
nodes {
id
nameWithOwner
}
}
}
}
}`,
{ projectId: '${{ steps.copy-project.outputs.id }}' }
);
assert.strictEqual(projectV2.repositories.nodes.length, 1, 'Expected one linked repository');
assert.strictEqual(projectV2.repositories.nodes[0].nameWithOwner, 'dsanders11/project-actions', 'Project not linked to repository');
assert.strictEqual(projectV2.repositories.nodes[0].id, '${{ steps.link-project-to-repo.outputs.repository-id }}', `Output 'repository-id' is not as expected`);
- name: Link Project to Team
uses: ./link-project/
id: link-project-to-team
if: ${{ matrix.owner == 'dsanders11-playground-org' }}
with:
owner: ${{ steps.copy-project.outputs.owner }}
project-number: ${{ steps.copy-project.outputs.number }}
team: dsanders11-playground-org/maintainers
token: ${{ steps.get-auth-token.outputs.token }}

- name: Check Project is Linked to Team
uses: ./github-script/
if: ${{ matrix.owner == 'dsanders11-playground-org' }}
with:
token: ${{ steps.get-auth-token.outputs.token }}
script: |
const assert = require('node:assert');
const { projectV2 } = await github.graphql(
`query getProjectLinkedRepos($projectId: ID!) {
projectV2: node(id: $projectId) {
... on ProjectV2 {
id
teams(first: 10) {
nodes {
id
name
}
}
}
}
}`,
{ projectId: '${{ steps.copy-project.outputs.id }}' }
);
assert.strictEqual(projectV2.teams.nodes.length, 1, 'Expected one linked team');
assert.strictEqual(projectV2.teams.nodes[0].name, 'maintainers', 'Project not linked to team');
assert.strictEqual(projectV2.teams.nodes[0].id, '${{ steps.link-project-to-team.outputs.team-id }}', `Output 'team-id' is not as expected`);
- name: Edit Project
uses: ./edit-project/
id: edit-project
Expand Down

0 comments on commit b62ccce

Please sign in to comment.