CI #389
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: CI | |
on: | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: '0 2 * * *' | |
jobs: | |
fetch_github_contributions: | |
name: Fetch GitHub contributions | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Import GPG key | |
uses: crazy-max/ghaction-import-gpg@v5 | |
with: | |
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.GPG_PASSPHRASE }} | |
git_user_signingkey: true | |
git_commit_gpgsign: true | |
- name: Fetch data and write to file | |
run: | | |
req=`curl -s -X POST -H "Authorization: bearer ${{ secrets.GH_TOKEN }}" -w "%{http_code}" -o js/github-contributions.js \ | |
-d '{ "query": "query UserContributions($username: String!) { user(login: $username) { repositoriesContributedTo(first: 100, contributionTypes: [COMMIT, PULL_REQUEST, REPOSITORY]) { nodes { name url owner { login avatarUrl url } } } } }", "variables": { "username": "hayk96" } }' https://api.github.com/graphql` | |
if [[ $req == '200' ]] ; then sed -i '1s/^/let githubData =\n/' js/github-contributions.js ; else false ; fi | |
- name: Commit and push changes | |
run: | | |
git commit -a --no-edit --allow-empty -S -s -m "Update contributions for $(date)" | |
git push |