89 lines
3.2 KiB
YAML
89 lines
3.2 KiB
YAML
name: OSS Weekend
|
|
|
|
on:
|
|
schedule:
|
|
- cron: "0 15,16 * * 5"
|
|
- cron: "5 22,23 * * 0"
|
|
workflow_dispatch:
|
|
inputs:
|
|
mode:
|
|
description: "close, open, or auto"
|
|
required: false
|
|
default: auto
|
|
type: choice
|
|
options:
|
|
- auto
|
|
- close
|
|
- open
|
|
dry_run:
|
|
description: "Preview changes without toggling issues or pushing README updates"
|
|
required: false
|
|
default: true
|
|
type: boolean
|
|
now:
|
|
description: "Optional ISO timestamp override for testing, e.g. 2026-03-20T16:00:00Z"
|
|
required: false
|
|
type: string
|
|
|
|
jobs:
|
|
oss-weekend:
|
|
runs-on: ubuntu-latest
|
|
environment: oss-weekend
|
|
permissions:
|
|
contents: write
|
|
env:
|
|
WORKFLOW_TOKEN: ${{ secrets.OSS_WEEKEND_TOKEN != '' && secrets.OSS_WEEKEND_TOKEN || github.token }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ github.event.repository.default_branch }}
|
|
token: ${{ secrets.OSS_WEEKEND_TOKEN != '' && secrets.OSS_WEEKEND_TOKEN || github.token }}
|
|
|
|
- name: Plan OSS weekend action
|
|
id: plan
|
|
env:
|
|
OSS_WEEKEND_MODE: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.mode || 'auto' }}
|
|
OSS_WEEKEND_DRY_RUN: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.dry_run || 'false' }}
|
|
OSS_WEEKEND_NOW: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.now || '' }}
|
|
run: node .github/scripts/oss-weekend.mjs
|
|
|
|
- name: Stop when no action is due
|
|
if: steps.plan.outputs.action == 'none'
|
|
run: echo "No OSS weekend action due at this time"
|
|
|
|
- name: Require OSS_WEEKEND_TOKEN for live runs
|
|
if: steps.plan.outputs.action != 'none' && steps.plan.outputs.dry_run != 'true' && secrets.OSS_WEEKEND_TOKEN == ''
|
|
run: |
|
|
echo "OSS_WEEKEND_TOKEN is required for live OSS weekend runs"
|
|
exit 1
|
|
|
|
- name: Toggle issue tracker
|
|
if: steps.plan.outputs.action != 'none' && steps.plan.outputs.dry_run != 'true'
|
|
env:
|
|
GH_TOKEN: ${{ env.WORKFLOW_TOKEN }}
|
|
run: |
|
|
if [ "${{ steps.plan.outputs.action }}" = "close" ]; then
|
|
gh api --method PATCH repos/${{ github.repository }} -f has_issues=false
|
|
else
|
|
gh api --method PATCH repos/${{ github.repository }} -f has_issues=true
|
|
fi
|
|
|
|
- name: Commit README update
|
|
if: steps.plan.outputs.readme_changed == 'true' && steps.plan.outputs.dry_run != 'true'
|
|
run: |
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
git add README.md
|
|
git diff --staged --quiet || git commit -m "${{ steps.plan.outputs.commit_message }}"
|
|
git push
|
|
|
|
- name: Summary
|
|
run: |
|
|
echo "action=${{ steps.plan.outputs.action }}"
|
|
echo "dry_run=${{ steps.plan.outputs.dry_run }}"
|
|
echo "readme_changed=${{ steps.plan.outputs.readme_changed }}"
|
|
echo "issue_state=${{ steps.plan.outputs.issue_state }}"
|
|
echo "now_utc=${{ steps.plan.outputs.now_utc }}"
|
|
echo "now_berlin=${{ steps.plan.outputs.now_berlin }}"
|