add support for K8s metrics API as a source of PVC usage data #105
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Add a new item to project | |
on: | |
issues: | |
types: | |
- opened | |
pull_request_target: | |
types: | |
- opened | |
jobs: | |
add_item: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Issue an access token | |
uses: actions/create-github-app-token@v1 | |
id: app-token | |
with: | |
app-id: ${{ secrets.PROJECT_APP_ID }} | |
private-key: ${{ secrets.PROJECT_APP_PEM }} | |
- name: Get project data | |
env: | |
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | |
ORGANIZATION: topolvm | |
PROJECT_NUMBER: "2" | |
run: | | |
proj_id="$(gh api graphql -f query=' | |
query($org: String!, $number: Int!) { | |
organization(login: $org){ | |
projectV2(number: $number) { | |
id | |
} | |
} | |
}' -F org=$ORGANIZATION -F number=$PROJECT_NUMBER --jq '.data.organization.projectV2.id')" | |
echo "PROJECT_ID=${proj_id}" >> $GITHUB_ENV | |
- name: Add an item to project | |
env: | |
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | |
run: | | |
if [ ${{ github.event_name }} = issues ]; then | |
CONTENT_ID=${{ github.event.issue.node_id }} | |
else | |
CONTENT_ID=${{ github.event.pull_request.node_id }} | |
fi | |
gh api graphql -f query=' | |
mutation($project:ID!, $contentId:ID!) { | |
addProjectV2ItemById(input: {projectId: $project, contentId: $contentId}) { | |
item { | |
id | |
} | |
} | |
}' -F project=$PROJECT_ID -F contentId=$CONTENT_ID --jq '.data.addProjectV2ItemById.item.id' |