Skip to content

Commit

Permalink
Testing.. again
Browse files Browse the repository at this point in the history
  • Loading branch information
ep-93 committed Sep 10, 2024
1 parent c030e4c commit 70f43b4
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 16 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
mutation($input: CreateCommitOnBranchInput!) {
createCommitOnBranch(input: $input) {
commit {
url
}
}
}
64 changes: 48 additions & 16 deletions .github/workflows/test-commit-signing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,53 @@ jobs:
- name: Setup git
run: echo ${{ github.head_ref || github.ref_name }}

- name: List current directory structure
run: ls -R /home/runner/work/house-of-fun/house-of-fun

- name: Create a change
- name: Create Commit on Branch using GraphQL API
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
mkdir -p code
touch code/test1.txt
git add code/test1.txt
# Define GraphQL mutation
mutation='
mutation($input: CreateCommitOnBranchInput!) {
createCommitOnBranch(input: $input) {
commit {
url
}
}
}
'
# Define the input payload for the mutation
branch="feature/signed-commits-testing" # Update with your target branch
message="Automated commit via GraphQL"
filePath="README.md" # Update with the file you want to modify
fileContent="This is an automated update."
# Commit all changed files back to the repository
- uses: planetscale/[email protected]
with:
commit_message: "🤖 fmt"
repo: ${{ github.repository }}
branch: ${{ github.head_ref || github.ref_name }}
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
# Create the payload for the mutation
payload=$(jq -n \
--arg branch "$branch" \
--arg message "$message" \
--arg filePath "$filePath" \
--arg fileContent "$fileContent" \
'{
"query": $mutation,
"variables": {
"input": {
"branch": { "repositoryName": "house-of-fun", "ownerName": "ep-93", "branchName": $branch },
"message": $message,
"fileChanges": {
"additions": [{
"path": $filePath,
"contents": $fileContent
}]
}
}
}
}'
)
# Make the API call
curl -X POST \
-H "Authorization: bearer $GITHUB_TOKEN" \
-H "Content-Type: application/json" \
-d "$payload" \
https://api.github.com/graphql

0 comments on commit 70f43b4

Please sign in to comment.