-
Notifications
You must be signed in to change notification settings - Fork 274
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Jobs archiving after 2 months instead of deleting
- Loading branch information
Showing
14 changed files
with
177 additions
and
55 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: Update Jobs | ||
|
||
on: | ||
schedule: | ||
- cron: "0 0 * * *" # This will run the workflow every day at midnight | ||
|
||
jobs: | ||
update-jobs: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
cache: yarn | ||
|
||
- name: Cache dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
.yarn/cache | ||
.yarn/install-state.gz | ||
.eslintcache | ||
**/tsconfig.tsbuildinfo | ||
**/.types/** | ||
**/.types-*/** | ||
key: build-cache-${{ hashFiles('yarn.lock') }} | ||
restore-keys: | | ||
build-cache- | ||
- name: Install dependencies | ||
run: yarn | ||
|
||
- name: Run update-jobs script | ||
run: yarn update-jobs | ||
|
||
- name: Commit and push changes | ||
run: | | ||
git config --global user.name 'GitHub Actions' | ||
git config --global user.email '[email protected]' | ||
git checkout dev | ||
git checkout -b update-jobs | ||
git add . | ||
git commit -m "Update jobs" | ||
git push origin update-jobs | ||
- name: pull-request | ||
uses: repo-sync/pull-request@v2 | ||
with: | ||
pr_title: "Jobs archiving PR" | ||
pr_body: | | ||
## How to approve and merge this pull request | ||
As a content contributor, follow these steps to review, approve, and merge this pull request: | ||
- [ ] 1. Review the changes made in this pull request by looking at the "Files changed" tab. Make sure everything looks correct and as expected. | ||
- [ ] 2. Visit the live preview of the changes at [https://starknet-website-dev.vercel.app/](https://starknet-website-dev.vercel.app/). Ensure the changes are properly implemented and everything is working as expected. | ||
- [ ] 3. If you are satisfied with the changes, click on the "Review changes" button (usually green) at the top of the pull request page. | ||
- [ ] 4. In the review summary dialog, select "Approve" and click on "Submit review." | ||
- [ ] 5. Click on "Confirm merge" to finalize the process. The changes will be applied to the production branch, and [starknet.io](http://starknet.io) will be updated within a few minutes. | ||
If you are unsure about merging something or need any assistance, please ping a developer to double check. | ||
pr_allow_empty: false | ||
pr_label: "auto-pr" | ||
source_branch: "update-jobs" | ||
destination_branch: "dev" | ||
github_token: ${{ secrets.GITHUB_TOKEN }} |
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
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 |
---|---|---|
|
@@ -18,3 +18,5 @@ job: | |
mentality. | ||
apply_url: mailto:[email protected] | ||
published_at: 2023-06-07T09:22:26.814Z | ||
status: active | ||
archive_after: 2 |
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
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,31 @@ | ||
import fs from "fs/promises"; | ||
import * as path from "path"; | ||
import YAML from "yaml"; | ||
process.chdir(path.resolve(__dirname, "../../..")); | ||
|
||
import { yaml } from "./utils"; | ||
|
||
async function updateJobs() { | ||
const resourceName = "jobs"; | ||
const filenames = await fs.readdir(`_data/${resourceName}`); | ||
|
||
for (const filename of filenames) { | ||
const filepath = path.join("_data", resourceName, filename); | ||
|
||
const data = await yaml(filepath); | ||
const isOlderThanTwoMonths = (dateString: string) => { | ||
const date = new Date(dateString); | ||
const today = new Date(); | ||
today.setMonth(today.getMonth() - data.archive_after); | ||
return date < today; | ||
} | ||
const isOlder = isOlderThanTwoMonths(data.published_at); | ||
if (isOlder) { | ||
data.status = "archived"; | ||
} | ||
await fs.writeFile(filepath, YAML.stringify(data), { | ||
encoding: "utf8", | ||
}); | ||
} | ||
} | ||
updateJobs(); |
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 |
---|---|---|
|
@@ -15,6 +15,7 @@ const texts = [ | |
"Servus zu", | ||
]; | ||
|
||
|
||
export const Intro = () => { | ||
const [index, setIndex] = useState(0); | ||
|
||
|
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