Skip to content

Commit

Permalink
Update keys from secrets to env vars (#1197)
Browse files Browse the repository at this point in the history
  • Loading branch information
staylorTT authored Nov 8, 2024
1 parent f35a2cb commit 09f34bc
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/issue-last-updated.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
name: Update Project Last Updated Date on Issue Update or comment
name: Update Project Date on Issue Update


on:
issues:
types: [edited, opened]
issue_comment:
types: [created]


env:
GITHUB_TOKEN: ${{ secrets.ISSUE_TOKEN }}


jobs:
update_project_date:
runs-on: ubuntu-latest
steps:
- name: Set Environment Variables
run: |
echo "project_id=PVT_kwDOA9MHEM4AjeTl" >> $GITHUB_ENV
echo "field_id=PVTF_lADOA9MHEM4AjeTlzgiiU18" >> $GITHUB_ENV
- name: Get Issue ID
id: get_issue_id
run: |
Expand All @@ -21,6 +29,7 @@ jobs:
issue_id=$(echo "$issue_details" | jq -r '.node_id')
echo "issue_id=$issue_id" >> $GITHUB_ENV
- name: Get Item ID for Issue
id: get_item_by_issue_id
run: |
Expand All @@ -29,7 +38,7 @@ jobs:
-d '{
"query": "query($projectId: ID!) { node(id: $projectId) { ... on ProjectV2 { items(first: 100) { nodes { id content { ... on Issue { id } } } } } } }",
"variables": {
"projectId": "'"${{ secrets.TT_FORGE_PROJECT_ID }}"'"
"projectId": "'"${{ env.project_id }}"'"
}
}' \
https://api.github.com/graphql | jq -r '.data.node.items.nodes[] | select(.content.id=="'"${{ env.issue_id }}"'") | .id')
Expand All @@ -40,6 +49,6 @@ jobs:
current_date=$(date +%Y-%m-%d)
curl -H "Authorization: Bearer ${{ secrets.ISSUE_TOKEN }}" \
-H "Content-Type: application/json" \
-d "{ \"query\": \"mutation { updateProjectV2ItemFieldValue(input: { projectId: \\\"${{ secrets.TT_FORGE_PROJECT_ID }}\\\", itemId: \\\"${{ env.ITEM_ID }}\\\", fieldId: \\\"${{ secrets.TT_FORGE_PROJECT_LAST_UPDATED_ID }}\\\", value: { date: \\\"$current_date\\\" } }) { clientMutationId } }\" }" \
-d "{ \"query\": \"mutation { updateProjectV2ItemFieldValue(input: { projectId: \\\"${{ env.project_id }}\\\", itemId: \\\"${{ env.ITEM_ID }}\\\", fieldId: \\\"${{ env.field_id }}\\\", value: { date: \\\"$current_date\\\" } }) { clientMutationId } }\" }" \
-X POST \
"https://api.github.com/graphql"

0 comments on commit 09f34bc

Please sign in to comment.