Skip to content

Commit

Permalink
feat: git action
Browse files Browse the repository at this point in the history
  • Loading branch information
AbigailDeng authored and AbigailDeng committed Jul 25, 2024
1 parent f8f9c0d commit 3436a95
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions .github/workflows/test-badge.yml
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ name: Test Badge
on:
push:
branches:
- master
- feature/use-github-actions

jobs:
test:
@@ -66,12 +66,21 @@ jobs:
const filePath = path.join(process.env.GITHUB_WORKSPACE, filename);
const fileContent = fs.readFileSync(filePath, 'utf8');
const { data: { sha } } = await github.rest.repos.getContent({
owner: context.repo.owner,
repo: context.repo.repo,
path: filename,
ref: 'feature/use-github-actions'
});
let sha;
try {
const { data } = await github.rest.repos.getContent({
owner: context.repo.owner,
repo: context.repo.repo,
path: filename,
ref: 'feature/use-github-actions'
});
sha = data.sha;
} catch (error) {
if (error.status !== 404) {
throw error;
}
// File does not exist, so we'll create it
}
await github.rest.repos.createOrUpdateFileContents({
owner: context.repo.owner,

0 comments on commit 3436a95

Please sign in to comment.