Skip to content

explicitly add dashboard.hackclub.app (#2769) #8091

explicitly add dashboard.hackclub.app (#2769)

explicitly add dashboard.hackclub.app (#2769) #8091

Workflow file for this run

name: test
on:
push:
branches:
- main
pull_request_target:
types: [opened, synchronize, labeled]
merge_group:
jobs:
octodns:
runs-on: ubuntu-latest
env:
DNSIMPLE_ACCOUNT_NUMBER: ${{ secrets.DNSIMPLE_ACCOUNT_NUMBER }}
DNSIMPLE_API_KEY: ${{ secrets.DNSIMPLE_API_KEY_READ_ONLY }}
CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN_READ_ONLY }}
steps:
# For forked PRs: checkout the PR head (fork + SHA)
- name: Checkout PR head
if: github.event_name == 'pull_request_target'
uses: actions/checkout@v6
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.sha }}
# For normal pushes: default checkout
- name: Checkout (push)
if: github.event_name != 'pull_request_target'
uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: '3'
- name: Install OctoDNS
run: pip install 'octodns>=1.5.0' octodns-cloudflare octodns-dnsimple
- name: Check for --force
id: check-force
uses: actions/github-script@v8
with:
script: |
let prNumber = null;
if (context.eventName === 'pull_request_target') {
prNumber = context.payload.pull_request.number;
core.info(`Event: pull_request_target, PR #${prNumber}`);
} else if (context.eventName === 'merge_group') {
const mqMatch = context.ref.match(/\/pr-(\d+)-/);
if (mqMatch) {
prNumber = parseInt(mqMatch[1]);
core.info(`Event: merge_group, extracted PR #${prNumber} from ref ${context.ref}`);
} else {
core.info(`Event: merge_group, could not extract PR number from ref ${context.ref}`);
}
} else {
core.info(`Event: ${context.eventName}, ref: ${context.ref}, looking up PR by commit ${context.sha}`);
const pulls = await github.rest.repos.listPullRequestsAssociatedWithCommit({
owner: context.repo.owner,
repo: context.repo.repo,
commit_sha: context.sha,
});
if (pulls.data.length > 0) {
prNumber = pulls.data[0].number;
core.info(`Found PR #${prNumber} associated with commit`);
} else {
core.info('No PR associated with this commit');
}
}
if (prNumber) {
const { data: pr } = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: prNumber,
});
const labels = pr.labels.map(l => l.name);
core.info(`PR #${prNumber} labels: ${JSON.stringify(labels)}`);
if (labels.includes('--force')) {
core.info('--force label found, enabling force mode');
core.setOutput('force', '--force');
} else {
core.info('--force label not found');
}
}
- name: Do a dry run
if: env.DNSIMPLE_ACCOUNT_NUMBER != ''
run: ./bin/dry-run ${{ steps.check-force.outputs.force }}