This repository has been archived by the owner on Sep 12, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5469145
commit 06b61c2
Showing
4 changed files
with
37 additions
and
14 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const core = require('@actions/core'); | ||
const github = require('@actions/github'); | ||
const admin = require('firebase-admin'); | ||
|
||
(async () => { | ||
try { | ||
const firebaseKey = core.getInput('firebase-key', { required: true }); | ||
|
||
admin.initializeApp({ | ||
credential: admin.credential.cert(JSON.parse(firebaseKey)), | ||
}); | ||
|
||
const db = admin.firestore(); | ||
const author = github.context.payload.sender; | ||
const type = process.env.GITHUB_EVENT_NAME; | ||
|
||
const docRef = db.collection('usersGitHub').doc(author.id); | ||
await docRef.set({ | ||
...author, | ||
type: admin.firestore.FieldValue.increment(1) | ||
}, { merge: true }); | ||
} catch (error) { | ||
core.setFailed(error.message); | ||
} | ||
})(); |