Reputation: 8033
I have copied/closed this repository (https://github.com/staticwebdev/vanilla-basic).
Now I want to create a HTML
(let's call it dummy.html
) in the src
folder of this repo with the content as below.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="styles.css">
<title>Vanilla JavaScript App</title>
</head>
<body>
<main>
<h1>Customer Approval Page</h1>
<h2> <customer name> </h2>
</main>
</body>
</html>
I found these 2 actions but they are not working for me. Can anyone help?
https://github.com/DamianReeves/write-file-action
https://github.com/1arp/create-a-file-action
Upvotes: 0
Views: 288
Reputation: 40603
I tested this with this workflow:
name: so-037-create-file
#https://stackoverflow.com/questions/73465583/github-actio-to-create-a-html-file-in-the-main-branch
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Overwrite file
uses: "DamianReeves/write-file-action@master"
with:
path: src/dummy.html
write-mode: preserve
contents: |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="styles.css">
<title>Vanilla JavaScript App</title>
</head>
<body>
<main>
<h1>Customer Approval Page</h1>
<h2> <customer name> </h2>
</main>
</body>
</html>
- name: Commit & Push
uses: Andro999b/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: main
force: true
message: 'Overwritten by Github Actions - ${date}'
and it works.
Folder before the run: Folder after the run:
Here is the link to the file.
Upvotes: 1